aboutsummaryrefslogtreecommitdiff
path: root/src/lib/models/Global.ts
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib/models/Global.ts')
-rw-r--r--src/lib/models/Global.ts50
1 files changed, 50 insertions, 0 deletions
diff --git a/src/lib/models/Global.ts b/src/lib/models/Global.ts
new file mode 100644
index 0000000..65f51c4
--- /dev/null
+++ b/src/lib/models/Global.ts
@@ -0,0 +1,50 @@
+import { Snowflake } from 'discord.js';
+import { DataTypes, Optional, Sequelize } from 'sequelize';
+import { BaseModel } from './BaseModel';
+
+export interface GlobalModel {
+ superUsers: Snowflake[];
+ disabledCommands: string[];
+ blacklistedUsers: Snowflake[];
+ blacklistedGuilds: Snowflake[];
+ blacklistedChannels: Snowflake[];
+}
+export type GlobalModelCreationAttributes = Optional<
+ GlobalModel,
+ 'superUsers' | 'disabledCommands' | 'blacklistedUsers' | 'blacklistedGuilds' | 'blacklistedChannels'
+>;
+
+export class Global extends BaseModel<GlobalModel, GlobalModelCreationAttributes> implements GlobalModel {
+ superUsers: Snowflake[];
+ disabledCommands: string[];
+ blacklistedUsers: Snowflake[];
+ blacklistedGuilds: Snowflake[];
+ blacklistedChannels: Snowflake[];
+ static initModel(sequelize: Sequelize): void {
+ Global.init(
+ {
+ superUsers: {
+ type: DataTypes.ARRAY(DataTypes.STRING),
+ allowNull: true
+ },
+ disabledCommands: {
+ type: DataTypes.ARRAY(DataTypes.STRING),
+ allowNull: true
+ },
+ blacklistedUsers: {
+ type: DataTypes.ARRAY(DataTypes.STRING),
+ allowNull: true
+ },
+ blacklistedGuilds: {
+ type: DataTypes.ARRAY(DataTypes.STRING),
+ allowNull: true
+ },
+ blacklistedChannels: {
+ type: DataTypes.ARRAY(DataTypes.STRING),
+ allowNull: true
+ }
+ },
+ { sequelize }
+ );
+ }
+}