diff options
author | IRONM00N <64110067+IRONM00N@users.noreply.github.com> | 2022-02-24 18:27:42 -0500 |
---|---|---|
committer | IRONM00N <64110067+IRONM00N@users.noreply.github.com> | 2022-02-24 18:27:42 -0500 |
commit | 9c83e59187b622807f8b5e8d3a514e3df4f9bd76 (patch) | |
tree | 9357d96894acfb8c582fb269775cb9c051c25881 | |
parent | 36d3ed87d744961eeba18bd5f378fd4d417f8ed5 (diff) | |
download | tanzanite-9c83e59187b622807f8b5e8d3a514e3df4f9bd76.tar.gz tanzanite-9c83e59187b622807f8b5e8d3a514e3df4f9bd76.tar.bz2 tanzanite-9c83e59187b622807f8b5e8d3a514e3df4f9bd76.zip |
fix(DisableCommand): make it actually do the correct action
-rw-r--r-- | src/commands/config/disable.ts | 4 | ||||
-rw-r--r-- | src/inhibitors/command/globalDisabledCommand.ts | 2 |
2 files changed, 3 insertions, 3 deletions
diff --git a/src/commands/config/disable.ts b/src/commands/config/disable.ts index db325fc..dea7b0f 100644 --- a/src/commands/config/disable.ts +++ b/src/commands/config/disable.ts @@ -59,7 +59,7 @@ export default class DisableCommand extends BushCommand { ) { assert(message.inGuild()); - let action = (args.action ?? message?.util?.parsed?.alias ?? 'toggle') as 'disable' | 'enable' | 'toggle'; + let action = (args.action ?? message.util?.parsed?.alias ?? 'toggle') as 'disable' | 'enable' | 'toggle'; const global = args.global && message.author.isOwner(); const commandID = args.command instanceof BushCommand ? args.command.id : (await util.arg.cast('commandAlias', message, args.command))?.id; @@ -72,7 +72,7 @@ export default class DisableCommand extends BushCommand { const disabledCommands = global ? util.getGlobal('disabledCommands') : await message.guild.getSetting('disabledCommands'); if (action === 'toggle') action = disabledCommands.includes(commandID) ? 'disable' : 'enable'; - const newValue = util.addOrRemoveFromArray(action === 'disable' ? 'remove' : 'add', disabledCommands, commandID); + const newValue = util.addOrRemoveFromArray(action === 'disable' ? 'add' : 'remove', disabledCommands, commandID); const success = global ? await util.setGlobal('disabledCommands', newValue).catch(() => false) : await message.guild.setSetting('disabledCommands', newValue, message.member!).catch(() => false); diff --git a/src/inhibitors/command/globalDisabledCommand.ts b/src/inhibitors/command/globalDisabledCommand.ts index 82163f0..0ec1305 100644 --- a/src/inhibitors/command/globalDisabledCommand.ts +++ b/src/inhibitors/command/globalDisabledCommand.ts @@ -12,7 +12,7 @@ export default class DisabledGuildCommandInhibitor extends BushInhibitor { public override async exec(message: BushMessage | BushSlashMessage, command: BushCommand): Promise<boolean> { if (message.author.isOwner()) return false; - if (client.cache.global.disabledCommands?.includes(command?.id)) { + 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}>>.` |