aboutsummaryrefslogtreecommitdiff
path: root/src/lib/models/ModLog.ts
diff options
context:
space:
mode:
authorIRONM00N <64110067+IRONM00N@users.noreply.github.com>2021-09-05 20:24:50 -0400
committerIRONM00N <64110067+IRONM00N@users.noreply.github.com>2021-09-05 20:24:50 -0400
commitc4c1d9ffeb179e208792c88dd099caea5030581b (patch)
treedc075bda115de5f6cec925c398f3c9547d1bad55 /src/lib/models/ModLog.ts
parentc238b0279c7686ca45506b0909e376f241cf0e30 (diff)
downloadtanzanite-c4c1d9ffeb179e208792c88dd099caea5030581b.tar.gz
tanzanite-c4c1d9ffeb179e208792c88dd099caea5030581b.tar.bz2
tanzanite-c4c1d9ffeb179e208792c88dd099caea5030581b.zip
add moderation logging, fixes, hide modlog, jank
Diffstat (limited to 'src/lib/models/ModLog.ts')
-rw-r--r--src/lib/models/ModLog.ts48
1 files changed, 47 insertions, 1 deletions
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 }