From 9c83e59187b622807f8b5e8d3a514e3df4f9bd76 Mon Sep 17 00:00:00 2001 From: IRONM00N <64110067+IRONM00N@users.noreply.github.com> Date: Thu, 24 Feb 2022 18:27:42 -0500 Subject: fix(DisableCommand): make it actually do the correct action --- src/commands/config/disable.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/commands/config') 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); -- cgit