From 5563d1d2ef228a69dad4e5d14bcc419a5f168893 Mon Sep 17 00:00:00 2001 From: nolan Date: Tue, 15 Jun 2021 21:49:17 -0700 Subject: [PATCH] Replace infraction types with static members --- structure/moderation/infractions/Addrole.js | 3 ++- structure/moderation/infractions/Ban.js | 3 ++- structure/moderation/infractions/Kick.js | 5 +++-- structure/moderation/infractions/Lockdown.js | 3 ++- structure/moderation/infractions/Mute.js | 3 ++- structure/moderation/infractions/Nickname.js | 3 ++- structure/moderation/infractions/Note.js | 3 ++- structure/moderation/infractions/Prune.js | 3 ++- structure/moderation/infractions/Removerole.js | 3 ++- structure/moderation/infractions/Slowmode.js | 3 ++- structure/moderation/infractions/Softban.js | 3 ++- structure/moderation/infractions/Unban.js | 3 ++- structure/moderation/infractions/Unlockdown.js | 3 ++- structure/moderation/infractions/Unmute.js | 3 ++- structure/moderation/infractions/Vckick.js | 3 ++- structure/moderation/infractions/Warn.js | 7 ++++++- 16 files changed, 37 insertions(+), 17 deletions(-) diff --git a/structure/moderation/infractions/Addrole.js b/structure/moderation/infractions/Addrole.js index e22968e..d8448f8 100644 --- a/structure/moderation/infractions/Addrole.js +++ b/structure/moderation/infractions/Addrole.js @@ -3,10 +3,11 @@ const { Infraction } = require('../interfaces/'); class AddroleInfraction extends Infraction { + static type = 'ADDROLE'; + constructor(client, opts = {}) { super(client, { - type: 'ADDROLE', targetType: 'USER', guild: opts.guild, channel: opts.channel, diff --git a/structure/moderation/infractions/Ban.js b/structure/moderation/infractions/Ban.js index 88bff1a..7b750b2 100644 --- a/structure/moderation/infractions/Ban.js +++ b/structure/moderation/infractions/Ban.js @@ -4,10 +4,11 @@ const { GuildMember } = require('../../extensions/'); class BanInfraction extends Infraction { + static type = 'BAN'; + constructor(client, opts = {}) { super(client, { - type: 'BAN', targetType: 'USER', guild: opts.guild, channel: opts.channel, diff --git a/structure/moderation/infractions/Kick.js b/structure/moderation/infractions/Kick.js index 53a1794..21b42f7 100644 --- a/structure/moderation/infractions/Kick.js +++ b/structure/moderation/infractions/Kick.js @@ -2,10 +2,11 @@ const { Infraction } = require('../interfaces/'); class KickInfraction extends Infraction { + static type = 'KICK'; + constructor(client, opts = {}) { - + super(client, { - type: 'KICK', targetType: 'USER', message: opts.message, executor: opts.executor.user, diff --git a/structure/moderation/infractions/Lockdown.js b/structure/moderation/infractions/Lockdown.js index 81a5465..b0cce1a 100644 --- a/structure/moderation/infractions/Lockdown.js +++ b/structure/moderation/infractions/Lockdown.js @@ -2,10 +2,11 @@ const { Infraction } = require('../interfaces/'); class LockdownInfraction extends Infraction { + static type = 'LOCKDOWN'; + constructor(client, opts = {}) { super(client, { - type: 'LOCKDOWN', targetType: 'USER', message: opts.message, executor: opts.executor.user, diff --git a/structure/moderation/infractions/Mute.js b/structure/moderation/infractions/Mute.js index 1e13be6..9a0bc82 100644 --- a/structure/moderation/infractions/Mute.js +++ b/structure/moderation/infractions/Mute.js @@ -3,10 +3,11 @@ const { Infraction } = require('../interfaces/'); class MuteInfraction extends Infraction { + static type = 'MUTE'; + constructor(client, opts = {}) { super(client, { - type: 'MUTE', targetType: 'USER', message: opts.message, executor: opts.executor.user, diff --git a/structure/moderation/infractions/Nickname.js b/structure/moderation/infractions/Nickname.js index 9e804e9..d0a83d5 100644 --- a/structure/moderation/infractions/Nickname.js +++ b/structure/moderation/infractions/Nickname.js @@ -10,10 +10,11 @@ const Constants = { class NicknameInfraction extends Infraction { + static type = 'NICKNAME'; + constructor(client, opts = {}) { super(client, { - type: 'NICKNAME', targetType: 'USER', executor: opts.executor.user, target: opts.target.user, diff --git a/structure/moderation/infractions/Note.js b/structure/moderation/infractions/Note.js index 93c81c3..a653ed9 100644 --- a/structure/moderation/infractions/Note.js +++ b/structure/moderation/infractions/Note.js @@ -2,10 +2,11 @@ const { Infraction } = require('../interfaces/'); class NoteInfraction extends Infraction { + static type = 'NOTE'; + constructor(client, opts = {}) { super(client, { - type: 'NOTE', targetType: 'USER', executor: opts.executor.user, target: opts.target.user, diff --git a/structure/moderation/infractions/Prune.js b/structure/moderation/infractions/Prune.js index 6c9fe85..f83387f 100644 --- a/structure/moderation/infractions/Prune.js +++ b/structure/moderation/infractions/Prune.js @@ -5,10 +5,11 @@ const Arguments = ['users', 'bots', 'humans', 'contains', 'startswith', 'endswit class PruneInfraction extends Infraction { + static type = 'PRUNE'; + constructor(client, opts = {}) { super(client, { - type: 'PRUNE', targetType: 'CHANNEL', message: opts.message, arguments: opts.arguments, diff --git a/structure/moderation/infractions/Removerole.js b/structure/moderation/infractions/Removerole.js index 72fc6e5..dcf07ff 100644 --- a/structure/moderation/infractions/Removerole.js +++ b/structure/moderation/infractions/Removerole.js @@ -3,10 +3,11 @@ const { Infraction } = require('../interfaces/'); class RemoveroleInfraction extends Infraction { + static type = 'REMOVEROLE'; + constructor(client, opts = {}) { super(client, { - type: 'REMOVEROLE', targetType: 'USER', message: opts.message, executor: opts.executor.user, diff --git a/structure/moderation/infractions/Slowmode.js b/structure/moderation/infractions/Slowmode.js index 282b5a8..a7d20e2 100644 --- a/structure/moderation/infractions/Slowmode.js +++ b/structure/moderation/infractions/Slowmode.js @@ -3,10 +3,11 @@ const { Util } = require('../../../util/'); class SlowmodeInfraction extends Infraction { + static type = 'SLOWMODE'; + constructor(client, opts = {}) { super(client, { - type: 'SLOWMODE', targetType: 'CHANNEL', message: opts.message, executor: opts.executor.user, diff --git a/structure/moderation/infractions/Softban.js b/structure/moderation/infractions/Softban.js index 0e56629..59e7d6b 100644 --- a/structure/moderation/infractions/Softban.js +++ b/structure/moderation/infractions/Softban.js @@ -3,10 +3,11 @@ const { GuildMember } = require('../../extensions/'); class SoftbanInfraction extends Infraction { + static type = 'SOFTBAN'; + constructor(client, opts = {}) { super(client, { - type: 'SOFTBAN', targetType: 'USER', message: opts.message, executor: opts.executor.user, diff --git a/structure/moderation/infractions/Unban.js b/structure/moderation/infractions/Unban.js index e9f5c89..04a3eb7 100644 --- a/structure/moderation/infractions/Unban.js +++ b/structure/moderation/infractions/Unban.js @@ -3,10 +3,11 @@ const { Infraction } = require('../interfaces/'); class UnbanInfraction extends Infraction { + static type = 'UNBAN'; + constructor(client, opts = {}) { super(client, { - type: 'UNBAN', targetType: 'USER', message: opts.message, executor: opts.executor.user, diff --git a/structure/moderation/infractions/Unlockdown.js b/structure/moderation/infractions/Unlockdown.js index 1dcd44d..48c8100 100644 --- a/structure/moderation/infractions/Unlockdown.js +++ b/structure/moderation/infractions/Unlockdown.js @@ -2,10 +2,11 @@ const { Infraction } = require('../interfaces/'); class UnlockdownInfraction extends Infraction { + static type = 'UNLOCKDOWN'; + constructor(client, opts = {}) { super(client, { - type: 'UNLOCKDOWN', targetType: 'USER', message: opts.message, executor: opts.executor.user, diff --git a/structure/moderation/infractions/Unmute.js b/structure/moderation/infractions/Unmute.js index cff5d76..cf761ee 100644 --- a/structure/moderation/infractions/Unmute.js +++ b/structure/moderation/infractions/Unmute.js @@ -3,10 +3,11 @@ const { Infraction } = require('../interfaces/'); class UnmuteInfraction extends Infraction { + static type = 'UNMUTE'; + constructor(client, opts = {}) { super(client, { - type: 'UNMUTE', targetType: 'USER', message: opts.message, executor: opts.executor.user, diff --git a/structure/moderation/infractions/Vckick.js b/structure/moderation/infractions/Vckick.js index d27cdf9..2b660ef 100644 --- a/structure/moderation/infractions/Vckick.js +++ b/structure/moderation/infractions/Vckick.js @@ -2,10 +2,11 @@ const { Infraction } = require('../interfaces/'); class VckickInfraction extends Infraction { + static type = 'VCKICK'; + constructor(client, opts = {}) { super(client, { - type: 'VCKICK', targetType: 'USER', message: opts.message, executor: opts.executor.user, diff --git a/structure/moderation/infractions/Warn.js b/structure/moderation/infractions/Warn.js index 7b3f1d1..0f5d4b6 100644 --- a/structure/moderation/infractions/Warn.js +++ b/structure/moderation/infractions/Warn.js @@ -2,10 +2,11 @@ const { Infraction } = require('../interfaces/'); class WarnInfraction extends Infraction { + static type = 'WARN'; + constructor(client, opts = {}) { super(client, { - type: 'WARN', targetType: 'USER', message: opts.message, executor: opts.executor.user, @@ -40,6 +41,10 @@ class WarnInfraction extends Infraction { } + static get type() { + return 'WARN'; + } + } module.exports = WarnInfraction; \ No newline at end of file