From 048f99752550c6e03d1990a03cad78f3ac7d73aa Mon Sep 17 00:00:00 2001 From: IRONM00N <64110067+IRONM00N@users.noreply.github.com> Date: Mon, 5 Sep 2022 17:36:42 -0400 Subject: revamp command permissions, fix permission exploit for some command when used in forum channels, use enums more --- src/inhibitors/blacklist/channelGlobalBlacklist.ts | 12 +++---- src/inhibitors/blacklist/channelGuildBlacklist.ts | 12 +++---- src/inhibitors/blacklist/guildBlacklist.ts | 12 +++---- src/inhibitors/blacklist/userGlobalBlacklist.ts | 12 +++---- src/inhibitors/blacklist/userGuildBlacklist.ts | 12 +++---- src/inhibitors/checks/cannotSend.ts | 39 ++++++++++++++++++++++ src/inhibitors/checks/fatal.ts | 10 +++--- src/inhibitors/checks/guildUnavailable.ts | 10 +++--- src/inhibitors/command/disabledGlobal.ts | 23 +++++++++++++ src/inhibitors/command/disabledGuild.ts | 25 ++++++++++++++ src/inhibitors/command/dm.ts | 8 ++--- src/inhibitors/command/globalDisabledCommand.ts | 23 ------------- src/inhibitors/command/guild.ts | 10 +++--- src/inhibitors/command/guildDisabledCommand.ts | 25 -------------- src/inhibitors/command/notNsfw.ts | 23 +++++++++++++ src/inhibitors/command/nsfw.ts | 23 ------------- src/inhibitors/command/owner.ts | 10 +++--- src/inhibitors/command/restrictedChannel.ts | 10 +++--- src/inhibitors/command/restrictedGuild.ts | 10 +++--- src/inhibitors/command/superUser.ts | 8 ++--- 20 files changed, 178 insertions(+), 139 deletions(-) create mode 100644 src/inhibitors/checks/cannotSend.ts create mode 100644 src/inhibitors/command/disabledGlobal.ts create mode 100644 src/inhibitors/command/disabledGuild.ts delete mode 100644 src/inhibitors/command/globalDisabledCommand.ts delete mode 100644 src/inhibitors/command/guildDisabledCommand.ts create mode 100644 src/inhibitors/command/notNsfw.ts delete mode 100644 src/inhibitors/command/nsfw.ts (limited to 'src/inhibitors') diff --git a/src/inhibitors/blacklist/channelGlobalBlacklist.ts b/src/inhibitors/blacklist/channelGlobalBlacklist.ts index 988931b..a212606 100644 --- a/src/inhibitors/blacklist/channelGlobalBlacklist.ts +++ b/src/inhibitors/blacklist/channelGlobalBlacklist.ts @@ -1,21 +1,21 @@ -import { BotInhibitor, type BotCommand, type CommandMessage, type SlashMessage } from '#lib'; +import { BotInhibitor, InhibitorReason, InhibitorType, type BotCommand, type CommandMessage, type SlashMessage } from '#lib'; export default class UserGlobalBlacklistInhibitor extends BotInhibitor { public constructor() { - super('channelGlobalBlacklist', { - reason: 'channelGlobalBlacklist', - type: 'post', + super(InhibitorReason.ChannelGlobalBlacklist, { + reason: InhibitorReason.ChannelGlobalBlacklist, + type: InhibitorType.Post, priority: 500 }); } public exec(message: CommandMessage | SlashMessage, command: BotCommand): boolean { if (!message.author || !message.inGuild()) return false; - // do not change to message.author.isOwner() + //! do not change to message.author.isOwner() if (this.client.isOwner(message.author) || this.client.user!.id === message.author.id) return false; if (this.client.cache.global.blacklistedChannels.includes(message.channel!.id) && !command.bypassChannelBlacklist) { void this.client.console.verbose( - 'channelGlobalBlacklist', + InhibitorReason.ChannelGlobalBlacklist, `Blocked message with id <<${message.id}>> from <<${message.author.tag}>> in <<${message.guild.name}>>.` ); return true; diff --git a/src/inhibitors/blacklist/channelGuildBlacklist.ts b/src/inhibitors/blacklist/channelGuildBlacklist.ts index 4bf42d2..ec81666 100644 --- a/src/inhibitors/blacklist/channelGuildBlacklist.ts +++ b/src/inhibitors/blacklist/channelGuildBlacklist.ts @@ -1,17 +1,17 @@ -import { BotInhibitor, type BotCommand, type CommandMessage, type SlashMessage } from '#lib'; +import { BotInhibitor, InhibitorReason, InhibitorType, type BotCommand, type CommandMessage, type SlashMessage } from '#lib'; export default class ChannelGuildBlacklistInhibitor extends BotInhibitor { public constructor() { - super('channelGuildBlacklist', { - reason: 'channelGuildBlacklist', - type: 'post', + super(InhibitorReason.ChannelGuildBlacklist, { + reason: InhibitorReason.ChannelGuildBlacklist, + type: InhibitorType.Post, priority: 499 }); } public async exec(message: CommandMessage | SlashMessage, command: BotCommand): Promise { if (!message.author || !message.inGuild()) return false; - // do not change to message.author.isOwner() + //! do not change to message.author.isOwner() if (this.client.isOwner(message.author) || this.client.user!.id === message.author.id) return false; if ( (await message.guild.getSetting('bypassChannelBlacklist'))?.includes(message.author.id) && @@ -24,7 +24,7 @@ export default class ChannelGuildBlacklistInhibitor extends BotInhibitor { !command.bypassChannelBlacklist ) { void this.client.console.verbose( - 'channelGuildBlacklist', + InhibitorReason.ChannelGuildBlacklist, `Blocked message with id <<${message.id}>> from <<${message.author.tag}>> in <<${message.guild.name}>>.` ); return true; diff --git a/src/inhibitors/blacklist/guildBlacklist.ts b/src/inhibitors/blacklist/guildBlacklist.ts index 636d0a3..b1f1543 100644 --- a/src/inhibitors/blacklist/guildBlacklist.ts +++ b/src/inhibitors/blacklist/guildBlacklist.ts @@ -1,17 +1,17 @@ -import { BotInhibitor, type CommandMessage, type SlashMessage } from '#lib'; +import { BotInhibitor, InhibitorReason, InhibitorType, type CommandMessage, type SlashMessage } from '#lib'; export default class GuildBlacklistInhibitor extends BotInhibitor { public constructor() { - super('guildBlacklist', { - reason: 'guildBlacklist', - type: 'all', + super(InhibitorReason.GuildBlacklist, { + reason: InhibitorReason.GuildBlacklist, + type: InhibitorType.All, priority: 50 }); } public exec(message: CommandMessage | SlashMessage): boolean { if (!message.author || !message.inGuild()) return false; - // do not change to message.author.isOwner() + //! do not change to message.author.isOwner() if ( this.client.isOwner(message.author) || this.client.isSuperUser(message.author) || @@ -20,7 +20,7 @@ export default class GuildBlacklistInhibitor extends BotInhibitor { return false; if (this.client.cache.global.blacklistedGuilds.includes(message.guild.id)) { void this.client.console.verbose( - 'guildBlacklist', + InhibitorReason.GuildBlacklist, `Blocked message with id <<${message.id}>> from <<${message.author.tag}>> in <<${message.guild.name}>>.` ); return true; diff --git a/src/inhibitors/blacklist/userGlobalBlacklist.ts b/src/inhibitors/blacklist/userGlobalBlacklist.ts index f5b15df..b0eacfc 100644 --- a/src/inhibitors/blacklist/userGlobalBlacklist.ts +++ b/src/inhibitors/blacklist/userGlobalBlacklist.ts @@ -1,21 +1,21 @@ -import { BotInhibitor, type CommandMessage, type SlashMessage } from '#lib'; +import { BotInhibitor, InhibitorReason, InhibitorType, type CommandMessage, type SlashMessage } from '#lib'; export default class UserGlobalBlacklistInhibitor extends BotInhibitor { public constructor() { - super('userGlobalBlacklist', { - reason: 'userGlobalBlacklist', - type: 'pre', + super(InhibitorReason.UserGlobalBlacklist, { + reason: InhibitorReason.UserGlobalBlacklist, + type: InhibitorType.Pre, priority: 30 }); } public exec(message: CommandMessage | SlashMessage): boolean { if (!message.author) return false; - // do not change to message.author.isOwner() + //! do not change to message.author.isOwner() if (this.client.isOwner(message.author) || this.client.user!.id === message.author.id) return false; if (this.client.cache.global.blacklistedUsers.includes(message.author.id)) { void this.client.console.verbose( - 'userGlobalBlacklist', + InhibitorReason.UserGlobalBlacklist, `Blocked message with id <<${message.id}>> from <<${message.author.tag}>> in <<${ message.inGuild() ? message.guild?.name : message.author.tag }>>.` diff --git a/src/inhibitors/blacklist/userGuildBlacklist.ts b/src/inhibitors/blacklist/userGuildBlacklist.ts index 3186d59..4330f87 100644 --- a/src/inhibitors/blacklist/userGuildBlacklist.ts +++ b/src/inhibitors/blacklist/userGuildBlacklist.ts @@ -1,17 +1,17 @@ -import { BotInhibitor, type CommandMessage, type SlashMessage } from '#lib'; +import { BotInhibitor, InhibitorReason, InhibitorType, type CommandMessage, type SlashMessage } from '#lib'; export default class UserGuildBlacklistInhibitor extends BotInhibitor { public constructor() { - super('userGuildBlacklist', { - reason: 'userGuildBlacklist', - type: 'pre', + super(InhibitorReason.UserGuildBlacklist, { + reason: InhibitorReason.UserGuildBlacklist, + type: InhibitorType.Pre, priority: 20 }); } public async exec(message: CommandMessage | SlashMessage): Promise { if (!message.author || !message.inGuild()) return false; - // do not change to message.author.isOwner() + //! do not change to message.author.isOwner() if ( this.client.isOwner(message.author) || this.client.isSuperUser(message.author) || @@ -20,7 +20,7 @@ export default class UserGuildBlacklistInhibitor extends BotInhibitor { return false; if ((await message.guild.getSetting('blacklistedUsers'))?.includes(message.author.id)) { void this.client.console.verbose( - 'userGuildBlacklist', + InhibitorReason.UserGuildBlacklist, `Blocked message with id <<${message.id}>> from <<${message.author.tag}>> in <<${message.guild.name}>>.` ); return true; diff --git a/src/inhibitors/checks/cannotSend.ts b/src/inhibitors/checks/cannotSend.ts new file mode 100644 index 0000000..e9eab98 --- /dev/null +++ b/src/inhibitors/checks/cannotSend.ts @@ -0,0 +1,39 @@ +import { BotCommand, BotInhibitor, InhibitorReason, InhibitorType, type SlashMessage } from '#lib'; +import { type Message } from 'discord.js'; + +export default class CannotSendInhibitor extends BotInhibitor { + public constructor() { + super(InhibitorReason.CannotSend, { + reason: InhibitorReason.CannotSend, + type: InhibitorType.Post, + priority: 1000 + }); + } + + public async exec(message: Message | SlashMessage, command: BotCommand): Promise { + // let it error if it is the owner + if (this.client.isOwner(message.author)) return false; + if (!message.inGuild() || !message.channel) return false; + if (command.skipSendCheck) return false; + + if (!message.guild.members.me) throw new Error(`Client member not cached in ${message.guild.name} (${message.guild.id})`); + + // doesn't apply to slash commands + if (message.util?.isSlash) return false; + + const sendPerm = message.channel.isThread() ? 'SendMessages' : 'SendMessagesInThreads'; + + const perms = message.channel.permissionsFor(message.guild.members.me); + + if (perms == null) { + // todo: remove once forum channels are fixed + if (message.channel.isThread() && message.channel.parent == null) { + return false; + } else { + return true; + } + } + + return !perms.has(sendPerm); + } +} diff --git a/src/inhibitors/checks/fatal.ts b/src/inhibitors/checks/fatal.ts index 4364d48..b585bd8 100644 --- a/src/inhibitors/checks/fatal.ts +++ b/src/inhibitors/checks/fatal.ts @@ -1,11 +1,11 @@ -import { BotInhibitor, type SlashMessage } from '#lib'; +import { BotInhibitor, InhibitorReason, InhibitorType, type SlashMessage } from '#lib'; import { type Message } from 'discord.js'; export default class FatalInhibitor extends BotInhibitor { public constructor() { - super('fatal', { - reason: 'fatal', - type: 'all', + super(InhibitorReason.Fatal, { + reason: InhibitorReason.Fatal, + type: InhibitorType.All, priority: 100 }); } @@ -16,7 +16,7 @@ export default class FatalInhibitor extends BotInhibitor { for (const property in globalCache) { if (!globalCache[property as keyof typeof globalCache]) { void this.client.console.verbose( - 'fatal', + InhibitorReason.Fatal, `Blocked message with id <<${message.id}>> from <<${message.author.tag}>> in <<${message.guild?.name}>>.` ); return true; diff --git a/src/inhibitors/checks/guildUnavailable.ts b/src/inhibitors/checks/guildUnavailable.ts index 4439d69..dc2ac26 100644 --- a/src/inhibitors/checks/guildUnavailable.ts +++ b/src/inhibitors/checks/guildUnavailable.ts @@ -1,11 +1,11 @@ -import { BotInhibitor, type SlashMessage } from '#lib'; +import { BotInhibitor, InhibitorReason, InhibitorType, type SlashMessage } from '#lib'; import { type Message } from 'discord.js'; export default class GuildUnavailableInhibitor extends BotInhibitor { public constructor() { - super('guildUnavailable', { - reason: 'guildUnavailable', - type: 'all', + super(InhibitorReason.GuildUnavailable, { + reason: InhibitorReason.GuildUnavailable, + type: InhibitorType.All, priority: 70 }); } @@ -13,7 +13,7 @@ export default class GuildUnavailableInhibitor extends BotInhibitor { public async exec(message: Message | SlashMessage): Promise { if (message.inGuild() && !message.guild.available) { void this.client.console.verbose( - 'guildUnavailable', + InhibitorReason.GuildUnavailable, `Blocked message with id <<${message.id}>> from <<${message.author.tag}>> in <<${message.guild.name}>>.` ); return true; diff --git a/src/inhibitors/command/disabledGlobal.ts b/src/inhibitors/command/disabledGlobal.ts new file mode 100644 index 0000000..bfb5969 --- /dev/null +++ b/src/inhibitors/command/disabledGlobal.ts @@ -0,0 +1,23 @@ +import { BotInhibitor, InhibitorReason, InhibitorType, type BotCommand, type CommandMessage, type SlashMessage } from '#lib'; + +export default class DisabledGlobalInhibitor extends BotInhibitor { + public constructor() { + super(InhibitorReason.DisabledGlobal, { + reason: InhibitorReason.DisabledGlobal, + type: InhibitorType.Post, + priority: 300 + }); + } + + public async exec(message: CommandMessage | SlashMessage, command: BotCommand): Promise { + if (message.author.isOwner()) return false; + if (this.client.cache.global.disabledCommands.includes(command?.id)) { + void this.client.console.verbose( + InhibitorReason.DisabledGlobal, + `Blocked message with id <<${message.id}>> from <<${message.author.tag}>> in <<${message.guild?.name}>>.` + ); + return true; + } + return false; + } +} diff --git a/src/inhibitors/command/disabledGuild.ts b/src/inhibitors/command/disabledGuild.ts new file mode 100644 index 0000000..0df827d --- /dev/null +++ b/src/inhibitors/command/disabledGuild.ts @@ -0,0 +1,25 @@ +import { BotInhibitor, InhibitorReason, InhibitorType, type BotCommand, type CommandMessage, type SlashMessage } from '#lib'; + +export default class DisabledGuildInhibitor extends BotInhibitor { + public constructor() { + super(InhibitorReason.DisabledGuild, { + reason: InhibitorReason.DisabledGuild, + type: InhibitorType.Post, + priority: 250 + }); + } + + public async exec(message: CommandMessage | SlashMessage, command: BotCommand): Promise { + if (!message.guild || !message.guild) return false; + if (message.author.isOwner() || message.author.isSuperUser()) return false; // super users bypass guild disabled commands + + if ((await message.guild.getSetting('disabledCommands'))?.includes(command?.id)) { + void this.client.console.verbose( + InhibitorReason.DisabledGuild, + `Blocked message with id <<${message.id}>> from <<${message.author.tag}>> in <<${message.guild.name}>>.` + ); + return true; + } + return false; + } +} diff --git a/src/inhibitors/command/dm.ts b/src/inhibitors/command/dm.ts index f25f542..aa39b94 100644 --- a/src/inhibitors/command/dm.ts +++ b/src/inhibitors/command/dm.ts @@ -1,10 +1,10 @@ -import { BotInhibitor, type BotCommand, type CommandMessage, type SlashMessage } from '#lib'; +import { BotInhibitor, InhibitorReason, InhibitorType, type BotCommand, type CommandMessage, type SlashMessage } from '#lib'; export default class DMInhibitor extends BotInhibitor { public constructor() { - super('dm', { - reason: 'dm', - type: 'post', + super(InhibitorReason.Dm, { + reason: InhibitorReason.Dm, + type: InhibitorType.Post, priority: 75 }); } diff --git a/src/inhibitors/command/globalDisabledCommand.ts b/src/inhibitors/command/globalDisabledCommand.ts deleted file mode 100644 index 4a93f2f..0000000 --- a/src/inhibitors/command/globalDisabledCommand.ts +++ /dev/null @@ -1,23 +0,0 @@ -import { BotInhibitor, type BotCommand, type CommandMessage, type SlashMessage } from '#lib'; - -export default class DisabledGuildCommandInhibitor extends BotInhibitor { - public constructor() { - super('disabledGlobalCommand', { - reason: 'disabledGlobal', - type: 'post', - priority: 300 - }); - } - - public async exec(message: CommandMessage | SlashMessage, command: BotCommand): Promise { - if (message.author.isOwner()) return false; - if (this.client.cache.global.disabledCommands.includes(command?.id)) { - void this.client.console.verbose( - 'disabledGlobalCommand', - `Blocked message with id <<${message.id}>> from <<${message.author.tag}>> in <<${message.guild?.name}>>.` - ); - return true; - } - return false; - } -} diff --git a/src/inhibitors/command/guild.ts b/src/inhibitors/command/guild.ts index 1d70c7d..24e2577 100644 --- a/src/inhibitors/command/guild.ts +++ b/src/inhibitors/command/guild.ts @@ -1,10 +1,10 @@ -import { BotInhibitor, type BotCommand, type CommandMessage, type SlashMessage } from '#lib'; +import { BotInhibitor, InhibitorReason, InhibitorType, type BotCommand, type CommandMessage, type SlashMessage } from '#lib'; export default class GuildInhibitor extends BotInhibitor { public constructor() { - super('guild', { - reason: 'guild', - type: 'post', + super(InhibitorReason.Guild, { + reason: InhibitorReason.Guild, + type: InhibitorType.Post, priority: 80 }); } @@ -12,7 +12,7 @@ export default class GuildInhibitor extends BotInhibitor { public async exec(message: CommandMessage | SlashMessage, command: BotCommand): Promise { if (command.channel === 'guild' && !message.guild) { void this.client.console.verbose( - 'guild', + InhibitorReason.Guild, `Blocked message with id <<${message.id}>> from <<${message.author.tag}>> in <<${message.author.tag}>>.` ); return true; diff --git a/src/inhibitors/command/guildDisabledCommand.ts b/src/inhibitors/command/guildDisabledCommand.ts deleted file mode 100644 index 97ac995..0000000 --- a/src/inhibitors/command/guildDisabledCommand.ts +++ /dev/null @@ -1,25 +0,0 @@ -import { BotInhibitor, type BotCommand, type CommandMessage, type SlashMessage } from '#lib'; - -export default class DisabledGuildCommandInhibitor extends BotInhibitor { - public constructor() { - super('disabledGuildCommand', { - reason: 'disabledGuild', - type: 'post', - priority: 250 - }); - } - - public async exec(message: CommandMessage | SlashMessage, command: BotCommand): Promise { - if (!message.guild || !message.guild) return false; - if (message.author.isOwner() || message.author.isSuperUser()) return false; // super users bypass guild disabled commands - - if ((await message.guild.getSetting('disabledCommands'))?.includes(command?.id)) { - void this.client.console.verbose( - 'disabledGuildCommand', - `Blocked message with id <<${message.id}>> from <<${message.author.tag}>> in <<${message.guild.name}>>.` - ); - return true; - } - return false; - } -} diff --git a/src/inhibitors/command/notNsfw.ts b/src/inhibitors/command/notNsfw.ts new file mode 100644 index 0000000..08e5556 --- /dev/null +++ b/src/inhibitors/command/notNsfw.ts @@ -0,0 +1,23 @@ +import { BotInhibitor, InhibitorReason, InhibitorType, type BotCommand, type CommandMessage, type SlashMessage } from '#lib'; +import { type TextChannel } from 'discord.js'; + +export default class NotNsfwInhibitor extends BotInhibitor { + public constructor() { + super(InhibitorReason.NotNsfw, { + reason: InhibitorReason.NotNsfw, + type: InhibitorType.Post, + priority: 25 + }); + } + + public async exec(message: CommandMessage | SlashMessage, command: BotCommand): Promise { + if (command.onlyNsfw && !(message.channel as TextChannel).nsfw) { + void this.client.console.verbose( + InhibitorReason.NotNsfw, + `Blocked message with id <<${message.id}>> from <<${message.author.tag}>> in <<${message.guild?.name}>>.` + ); + return true; + } + return false; + } +} diff --git a/src/inhibitors/command/nsfw.ts b/src/inhibitors/command/nsfw.ts deleted file mode 100644 index 623115e..0000000 --- a/src/inhibitors/command/nsfw.ts +++ /dev/null @@ -1,23 +0,0 @@ -import { BotInhibitor, type BotCommand, type CommandMessage, type SlashMessage } from '#lib'; -import { type TextChannel } from 'discord.js'; - -export default class NsfwInhibitor extends BotInhibitor { - public constructor() { - super('nsfw', { - reason: 'notNsfw', - type: 'post', - priority: 25 - }); - } - - public async exec(message: CommandMessage | SlashMessage, command: BotCommand): Promise { - if (command.onlyNsfw && !(message.channel as TextChannel).nsfw) { - void this.client.console.verbose( - 'notNsfw', - `Blocked message with id <<${message.id}>> from <<${message.author.tag}>> in <<${message.guild?.name}>>.` - ); - return true; - } - return false; - } -} diff --git a/src/inhibitors/command/owner.ts b/src/inhibitors/command/owner.ts index 15643be..8736cff 100644 --- a/src/inhibitors/command/owner.ts +++ b/src/inhibitors/command/owner.ts @@ -1,10 +1,10 @@ -import { BotInhibitor, type BotCommand, type CommandMessage, type SlashMessage } from '#lib'; +import { BotInhibitor, InhibitorReason, InhibitorType, type BotCommand, type CommandMessage, type SlashMessage } from '#lib'; export default class OwnerInhibitor extends BotInhibitor { public constructor() { - super('owner', { - reason: 'owner', - type: 'post', + super(InhibitorReason.Owner, { + reason: InhibitorReason.Owner, + type: InhibitorType.Post, priority: 100 }); } @@ -13,7 +13,7 @@ export default class OwnerInhibitor extends BotInhibitor { if (command.ownerOnly) { if (!this.client.isOwner(message.author)) { void this.client.console.verbose( - 'owner', + InhibitorReason.Owner, `Blocked message with id <<${message.id}>> from <<${message.author.tag}>> in <<${message.guild?.name}>>.` ); return true; diff --git a/src/inhibitors/command/restrictedChannel.ts b/src/inhibitors/command/restrictedChannel.ts index ec23604..bfacebc 100644 --- a/src/inhibitors/command/restrictedChannel.ts +++ b/src/inhibitors/command/restrictedChannel.ts @@ -1,10 +1,10 @@ -import { BotInhibitor, type BotCommand, type CommandMessage, type SlashMessage } from '#lib'; +import { BotInhibitor, InhibitorReason, InhibitorType, type BotCommand, type CommandMessage, type SlashMessage } from '#lib'; export default class RestrictedChannelInhibitor extends BotInhibitor { public constructor() { - super('restrictedChannel', { - reason: 'restrictedChannel', - type: 'post', + super(InhibitorReason.RestrictedChannel, { + reason: InhibitorReason.RestrictedChannel, + type: InhibitorType.Post, priority: 10 }); } @@ -13,7 +13,7 @@ export default class RestrictedChannelInhibitor extends BotInhibitor { if (command.restrictedChannels?.length && message.channel) { if (!command.restrictedChannels.includes(message.channel.id)) { void this.client.console.verbose( - 'restrictedChannel', + InhibitorReason.RestrictedChannel, `Blocked message with id <<${message.id}>> from <<${message.author.tag}>> in <<${message.guild?.name}>>.` ); return true; diff --git a/src/inhibitors/command/restrictedGuild.ts b/src/inhibitors/command/restrictedGuild.ts index ec0ad2c..4520cbc 100644 --- a/src/inhibitors/command/restrictedGuild.ts +++ b/src/inhibitors/command/restrictedGuild.ts @@ -1,10 +1,10 @@ -import { BotInhibitor, type BotCommand, type CommandMessage, type SlashMessage } from '#lib'; +import { BotInhibitor, InhibitorReason, InhibitorType, type BotCommand, type CommandMessage, type SlashMessage } from '#lib'; export default class RestrictedGuildInhibitor extends BotInhibitor { public constructor() { - super('restrictedGuild', { - reason: 'restrictedGuild', - type: 'post', + super(InhibitorReason.RestrictedGuild, { + reason: InhibitorReason.RestrictedGuild, + type: InhibitorType.Post, priority: 5 }); } @@ -13,7 +13,7 @@ export default class RestrictedGuildInhibitor extends BotInhibitor { if (command.restrictedChannels?.length && message.channel) { if (!command.restrictedChannels.includes(message.channel.id)) { void this.client.console.verbose( - 'restrictedGuild', + InhibitorReason.RestrictedGuild, `Blocked message with id <<${message.id}>> from <<${message.author.tag}>> in <<${message.guild?.name}>>.` ); return true; diff --git a/src/inhibitors/command/superUser.ts b/src/inhibitors/command/superUser.ts index a923c1a..dd71539 100644 --- a/src/inhibitors/command/superUser.ts +++ b/src/inhibitors/command/superUser.ts @@ -1,10 +1,10 @@ -import { BotInhibitor, type BotCommand, type CommandMessage, type SlashMessage } from '#lib'; +import { BotInhibitor, InhibitorReason, InhibitorType, type BotCommand, type CommandMessage, type SlashMessage } from '#lib'; export default class SuperUserInhibitor extends BotInhibitor { public constructor() { - super('superUser', { - reason: 'superUser', - type: 'post', + super(InhibitorReason.SuperUser, { + reason: InhibitorReason.SuperUser, + type: InhibitorType.Post, priority: 99 }); } -- cgit