diff options
Diffstat (limited to 'src/lib/models')
-rw-r--r-- | src/lib/models/Guild.ts | 2 | ||||
-rw-r--r-- | src/lib/models/ModLog.ts | 48 |
2 files changed, 48 insertions, 2 deletions
diff --git a/src/lib/models/Guild.ts b/src/lib/models/Guild.ts index 6933794..a4780fd 100644 --- a/src/lib/models/Guild.ts +++ b/src/lib/models/Guild.ts @@ -99,7 +99,7 @@ export const guildLogsObj = { }, moderation: { description: 'Sends a message in this channel every time a moderation action is performed.', - configurable: false + configurable: true }, report: { description: 'Logs user reports.', diff --git a/src/lib/models/ModLog.ts b/src/lib/models/ModLog.ts index 0be1ea7..5c87331 100644 --- a/src/lib/models/ModLog.ts +++ b/src/lib/models/ModLog.ts @@ -2,7 +2,7 @@ import { Snowflake } from 'discord.js'; import { DataTypes, Sequelize } from 'sequelize'; import { v4 as uuidv4 } from 'uuid'; import { BaseModel } from './BaseModel'; -import { NEVER_USED } from './__helpers'; +import { jsonParseGet, jsonParseSet, NEVER_USED } from './__helpers'; export enum ModLogType { PERM_BAN = 'PERM_BAN', @@ -30,6 +30,8 @@ export interface ModLogModel { duration: number | null; guild: Snowflake; evidence: string; + pseudo: boolean; + hidden: boolean; } export interface ModLogModelCreationAttributes { @@ -41,6 +43,8 @@ export interface ModLogModelCreationAttributes { duration?: number; guild: Snowflake; evidence?: string; + pseudo?: boolean; + hidden?: boolean; } export class ModLog extends BaseModel<ModLogModel, ModLogModelCreationAttributes> implements ModLogModel { @@ -124,6 +128,26 @@ export class ModLog extends BaseModel<ModLogModel, ModLogModelCreationAttributes throw new Error(NEVER_USED); } + /** + * Not an actual modlog just used so a punishment entry can be made + */ + public get pseudo(): boolean { + throw new Error(NEVER_USED); + } + public set pseudo(_: boolean) { + throw new Error(NEVER_USED); + } + + /** + * Hides from the modlog command unless show hidden is specified. + */ + public get hidden(): boolean { + throw new Error(NEVER_USED); + } + public set hidden(_: boolean) { + throw new Error(NEVER_USED); + } + public static initModel(sequelize: Sequelize): void { ModLog.init( { @@ -163,6 +187,28 @@ export class ModLog extends BaseModel<ModLogModel, ModLogModelCreationAttributes evidence: { type: DataTypes.TEXT, allowNull: true + }, + pseudo: { + type: DataTypes.STRING, + get: function (): boolean { + return jsonParseGet('pseudo', this); + }, + set: function (val: boolean) { + return jsonParseSet('pseudo', this, val); + }, + allowNull: false, + defaultValue: 'false' + }, + hidden: { + type: DataTypes.STRING, + get: function (): boolean { + return jsonParseGet('hidden', this); + }, + set: function (val: boolean) { + return jsonParseSet('hidden', this, val); + }, + allowNull: false, + defaultValue: 'false' } }, { sequelize: sequelize } |