aboutsummaryrefslogtreecommitdiff
path: root/src/lib/models/Guild.ts
diff options
context:
space:
mode:
authorIRONM00N <64110067+IRONM00N@users.noreply.github.com>2021-07-17 10:25:46 -0400
committerIRONM00N <64110067+IRONM00N@users.noreply.github.com>2021-07-17 10:25:46 -0400
commitd1724227abfb8f0fcd9e573f7e9772cf0be8257a (patch)
tree52c9dbae1fbbbd3c777d9c16ab643c477141ae21 /src/lib/models/Guild.ts
parent53d2b18f7f73d5696fb7cd86d1c164a790dfdcc3 (diff)
downloadtanzanite-d1724227abfb8f0fcd9e573f7e9772cf0be8257a.tar.gz
tanzanite-d1724227abfb8f0fcd9e573f7e9772cf0be8257a.tar.bz2
tanzanite-d1724227abfb8f0fcd9e573f7e9772cf0be8257a.zip
honestly no idea what I did at this point
Diffstat (limited to 'src/lib/models/Guild.ts')
-rw-r--r--src/lib/models/Guild.ts48
1 files changed, 46 insertions, 2 deletions
diff --git a/src/lib/models/Guild.ts b/src/lib/models/Guild.ts
index 43fcd64..30072b3 100644
--- a/src/lib/models/Guild.ts
+++ b/src/lib/models/Guild.ts
@@ -8,9 +8,12 @@ export interface GuildModel {
prefix: string;
autoPublishChannels: Snowflake[];
blacklistedChannels: Snowflake[];
+ blacklistedUsers: Snowflake[];
welcomeChannel: Snowflake;
muteRole: Snowflake;
punishmentEnding: string;
+ disabledCommands: string[];
+ lockdownChannels: Snowflake[];
}
export interface GuildModelCreationAttributes {
@@ -18,9 +21,12 @@ export interface GuildModelCreationAttributes {
prefix?: string;
autoPublishChannels?: Snowflake[];
blacklistedChannels?: Snowflake[];
+ blacklistedUsers?: Snowflake[];
welcomeChannel?: Snowflake;
muteRole?: Snowflake;
punishmentEnding?: string;
+ disabledCommands?: string[];
+ lockdownChannels?: Snowflake[];
}
export class Guild extends BaseModel<GuildModel, GuildModelCreationAttributes> implements GuildModel {
@@ -28,9 +34,12 @@ export class Guild extends BaseModel<GuildModel, GuildModelCreationAttributes> i
prefix!: string;
autoPublishChannels: Snowflake[];
blacklistedChannels: Snowflake[];
+ blacklistedUsers: Snowflake[];
welcomeChannel: Snowflake;
muteRole: Snowflake;
punishmentEnding: string;
+ disabledCommands: string[];
+ lockdownChannels: Snowflake[];
static initModel(sequelize: Sequelize, client: BushClient): void {
Guild.init(
@@ -52,7 +61,8 @@ export class Guild extends BaseModel<GuildModel, GuildModelCreationAttributes> i
set: function (val: Snowflake[]) {
return this.setDataValue('autoPublishChannels', JSON.stringify(val) as unknown as Snowflake[]);
},
- allowNull: true
+ allowNull: false,
+ defaultValue: '[]'
},
blacklistedChannels: {
type: DataTypes.STRING,
@@ -62,7 +72,19 @@ export class Guild extends BaseModel<GuildModel, GuildModelCreationAttributes> i
set: function (val: Snowflake[]) {
return this.setDataValue('blacklistedChannels', JSON.stringify(val) as unknown as Snowflake[]);
},
- allowNull: true
+ allowNull: false,
+ defaultValue: '[]'
+ },
+ blacklistedUsers: {
+ type: DataTypes.STRING,
+ get: function () {
+ return JSON.parse(this.getDataValue('blacklistedUsers') as unknown as string);
+ },
+ set: function (val: Snowflake[]) {
+ return this.setDataValue('blacklistedUsers', JSON.stringify(val) as unknown as Snowflake[]);
+ },
+ allowNull: false,
+ defaultValue: '[]'
},
welcomeChannel: {
type: DataTypes.STRING,
@@ -75,6 +97,28 @@ export class Guild extends BaseModel<GuildModel, GuildModelCreationAttributes> i
punishmentEnding: {
type: DataTypes.TEXT,
allowNull: true
+ },
+ disabledCommands: {
+ type: DataTypes.STRING,
+ get: function () {
+ return JSON.parse(this.getDataValue('disabledCommands') as unknown as string);
+ },
+ set: function (val: string[]) {
+ return this.setDataValue('disabledCommands', JSON.stringify(val) as unknown as string[]);
+ },
+ allowNull: false,
+ defaultValue: '[]'
+ },
+ lockdownChannels: {
+ type: DataTypes.STRING,
+ get: function () {
+ return JSON.parse(this.getDataValue('lockdownChannels') as unknown as string);
+ },
+ set: function (val: Snowflake[]) {
+ return this.setDataValue('lockdownChannels', JSON.stringify(val) as unknown as Snowflake[]);
+ },
+ allowNull: false,
+ defaultValue: '[]'
}
},
{ sequelize: sequelize }