diff options
author | IRONM00N <64110067+IRONM00N@users.noreply.github.com> | 2021-10-12 20:27:37 -0400 |
---|---|---|
committer | IRONM00N <64110067+IRONM00N@users.noreply.github.com> | 2021-10-12 20:27:37 -0400 |
commit | ba2d7b7db0a627234ed08de9d6bec8cb675404a7 (patch) | |
tree | 9ade9ed549b52eac3f2966a5cee5478267eca7c4 /src/lib/models | |
parent | cac6abf3efd563b83f8f0ce70ce4bcfa5ada1a27 (diff) | |
download | tanzanite-ba2d7b7db0a627234ed08de9d6bec8cb675404a7.tar.gz tanzanite-ba2d7b7db0a627234ed08de9d6bec8cb675404a7.tar.bz2 tanzanite-ba2d7b7db0a627234ed08de9d6bec8cb675404a7.zip |
revamp automod, refactoring, fixes
Diffstat (limited to 'src/lib/models')
-rw-r--r-- | src/lib/models/Guild.ts | 25 |
1 files changed, 19 insertions, 6 deletions
diff --git a/src/lib/models/Guild.ts b/src/lib/models/Guild.ts index 997be6a..f1ea43b 100644 --- a/src/lib/models/Guild.ts +++ b/src/lib/models/Guild.ts @@ -1,5 +1,6 @@ import { Snowflake } from 'discord.js'; import { DataTypes, Sequelize } from 'sequelize'; +import { BadWords } from '../common/automod'; import { BushClient } from '../extensions/discord-akairo/BushClient'; import { BaseModel } from './BaseModel'; import { jsonArrayInit, jsonParseGet, jsonParseSet, NEVER_USED } from './__helpers'; @@ -109,6 +110,14 @@ export const guildFeaturesObj = asGuildFeature({ name: 'Automod', description: 'Deletes offensive content as well as phishing links.' }, + excludeDefaultAutomod: { + name: 'Exclude Default Automod', + description: 'Opt out of using the default automod options.' + }, + excludeAutomodScamLinks: { + name: 'Exclude Automod Scam Links', + description: 'Opt out of having automod delete scam links.' + }, autoPublish: { name: 'Auto Publish', description: 'Publishes messages in configured announcement channels.' @@ -159,6 +168,10 @@ export const guildLogsObj = { report: { description: 'Logs user reports.', configurable: true + }, + error: { + description: 'Logs errors that occur with the bot.', + configurable: true } }; export type GuildLogType = keyof typeof guildLogsObj; @@ -181,7 +194,7 @@ export interface GuildModel { punishmentEnding: string; disabledCommands: string[]; lockdownChannels: Snowflake[]; - autoModPhases: { [word: string]: 0 | 1 | 2 | 3 }; + autoModPhases: BadWords; enabledFeatures: GuildFeatures[]; joinRoles: Snowflake[]; logChannels: LogChannelDB; @@ -202,7 +215,7 @@ export interface GuildModelCreationAttributes { punishmentEnding?: string; disabledCommands?: string[]; lockdownChannels?: Snowflake[]; - autoModPhases?: { [word: string]: 0 | 1 | 2 | 3 }; + autoModPhases?: BadWords; enabledFeatures?: GuildFeatures[]; joinRoles?: Snowflake[]; logChannels?: LogChannelDB; @@ -316,10 +329,10 @@ export class Guild extends BaseModel<GuildModel, GuildModelCreationAttributes> i /** * Custom automod phases */ - public get autoModPhases(): { [word: string]: 0 | 1 | 2 | 3 } { + public get autoModPhases(): BadWords { throw new Error(NEVER_USED); } - public set autoModPhases(_: { [word: string]: 0 | 1 | 2 | 3 }) { + public set autoModPhases(_: BadWords) { throw new Error(NEVER_USED); } @@ -424,10 +437,10 @@ export class Guild extends BaseModel<GuildModel, GuildModelCreationAttributes> i lockdownChannels: jsonArrayInit('lockdownChannels'), autoModPhases: { type: DataTypes.TEXT, - get: function (): { [level: number]: Snowflake } { + get: function (): BadWords { return jsonParseGet.call(this, 'autoModPhases'); }, - set: function (val: { [level: number]: Snowflake }) { + set: function (val: BadWords) { return jsonParseSet.call(this, 'autoModPhases', val); }, allowNull: false, |