From a39aa8c11a3fd5dd5f007865960ef5429744f057 Mon Sep 17 00:00:00 2001 From: IRONM00N <64110067+IRONM00N@users.noreply.github.com> Date: Sun, 7 Nov 2021 09:25:13 -0500 Subject: made some constants enums and fixed perm check overriding inhibitors --- src/inhibitors/command/dm.ts | 1 + src/inhibitors/command/globalDisabledCommand.ts | 1 + src/inhibitors/command/guild.ts | 1 + src/inhibitors/command/guildDisabledCommand.ts | 1 + src/inhibitors/command/nsfw.ts | 1 + src/inhibitors/command/owner.ts | 1 + src/inhibitors/command/restrictedChannel.ts | 1 + src/inhibitors/command/restrictedGuild.ts | 1 + src/inhibitors/command/superUser.ts | 1 + 9 files changed, 9 insertions(+) (limited to 'src/inhibitors/command') diff --git a/src/inhibitors/command/dm.ts b/src/inhibitors/command/dm.ts index c52425e..34fcb12 100644 --- a/src/inhibitors/command/dm.ts +++ b/src/inhibitors/command/dm.ts @@ -12,6 +12,7 @@ export default class DMInhibitor extends BushInhibitor { public override async exec(message: BushMessage | BushSlashMessage, command: BushCommand): Promise { if (command.channel === 'dm' && message.guild) { + void client.console.verbose('dm', `Blocked message with id <<${message.id}>> from <<${message.author.tag}>> in <<${message.guild.name}>>.`) return true; } return false; diff --git a/src/inhibitors/command/globalDisabledCommand.ts b/src/inhibitors/command/globalDisabledCommand.ts index 80c1735..da267ef 100644 --- a/src/inhibitors/command/globalDisabledCommand.ts +++ b/src/inhibitors/command/globalDisabledCommand.ts @@ -13,6 +13,7 @@ export default class DisabledGuildCommandInhibitor extends BushInhibitor { public override async exec(message: BushMessage | BushSlashMessage, command: BushCommand): Promise { if (message.author.isOwner()) return false; if (client.cache.global.disabledCommands?.includes(command?.id)) { + void 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 d5f4f17..9843972 100644 --- a/src/inhibitors/command/guild.ts +++ b/src/inhibitors/command/guild.ts @@ -12,6 +12,7 @@ export default class GuildInhibitor extends BushInhibitor { public override async exec(message: BushMessage | BushSlashMessage, command: BushCommand): Promise { if (command.channel === 'guild' && !message.guild) { + void client.console.verbose('guild', `Blocked message with id <<${message.id}>> from <<${message.author.tag}>> in <<${message.author.tag}>>.`) return true; } return false; diff --git a/src/inhibitors/command/guildDisabledCommand.ts b/src/inhibitors/command/guildDisabledCommand.ts index 6b69e41..4343b1a 100644 --- a/src/inhibitors/command/guildDisabledCommand.ts +++ b/src/inhibitors/command/guildDisabledCommand.ts @@ -15,6 +15,7 @@ export default class DisabledGuildCommandInhibitor extends BushInhibitor { 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 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/nsfw.ts b/src/inhibitors/command/nsfw.ts index 3944fe3..7f0f3e7 100644 --- a/src/inhibitors/command/nsfw.ts +++ b/src/inhibitors/command/nsfw.ts @@ -13,6 +13,7 @@ export default class NsfwInhibitor extends BushInhibitor { public override async exec(message: BushMessage | BushSlashMessage, command: BushCommand): Promise { if (command.onlyNsfw && !(message.channel as TextChannel).nsfw) { + void 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 816db0b..86bab76 100644 --- a/src/inhibitors/command/owner.ts +++ b/src/inhibitors/command/owner.ts @@ -13,6 +13,7 @@ export default class OwnerInhibitor extends BushInhibitor { public override async exec(message: BushMessage | BushSlashMessage, command: BushCommand): Promise { if (command.ownerOnly) { if (!client.isOwner(message.author)) { + void client.console.verbose('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 0f5efce..265200e 100644 --- a/src/inhibitors/command/restrictedChannel.ts +++ b/src/inhibitors/command/restrictedChannel.ts @@ -13,6 +13,7 @@ export default class RestrictedChannelInhibitor extends BushInhibitor { public override async exec(message: BushMessage | BushSlashMessage, command: BushCommand): Promise { if (command.restrictedChannels?.length && message.channel) { if (!command.restrictedChannels.includes(message.channel.id)) { + void client.console.verbose('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 7b5dc58..a27220c 100644 --- a/src/inhibitors/command/restrictedGuild.ts +++ b/src/inhibitors/command/restrictedGuild.ts @@ -13,6 +13,7 @@ export default class RestrictedGuildInhibitor extends BushInhibitor { public override async exec(message: BushMessage | BushSlashMessage, command: BushCommand): Promise { if (command.restrictedChannels?.length && message.channel) { if (!command.restrictedChannels.includes(message.channel.id)) { + void client.console.verbose('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 12f7246..a34df6d 100644 --- a/src/inhibitors/command/superUser.ts +++ b/src/inhibitors/command/superUser.ts @@ -13,6 +13,7 @@ export default class SuperUserInhibitor extends BushInhibitor { public override async exec(message: BushMessage | BushSlashMessage, command: BushCommand): Promise { if (command.superUserOnly) { if (!client.isSuperUser(message.author)) { + void client.console.verbose('superUser', `Blocked message with id <<${message.id}>> from <<${message.author.tag}>> in <<${message.guild?.name}>>.`) return true; } } -- cgit