diff options
author | IRONM00N <64110067+IRONM00N@users.noreply.github.com> | 2022-08-24 23:15:44 -0400 |
---|---|---|
committer | IRONM00N <64110067+IRONM00N@users.noreply.github.com> | 2022-08-24 23:15:44 -0400 |
commit | 31b05eeb34f1d9e9d89718333e0ec59cd405fc51 (patch) | |
tree | 8084a5a90d46179768c6e297762799bd288593fb /lib/extensions | |
parent | a7fd90aeee9161d10cd7ac37fe105606a23718bd (diff) | |
download | tanzanite-31b05eeb34f1d9e9d89718333e0ec59cd405fc51.tar.gz tanzanite-31b05eeb34f1d9e9d89718333e0ec59cd405fc51.tar.bz2 tanzanite-31b05eeb34f1d9e9d89718333e0ec59cd405fc51.zip |
fix slash command permissions
Diffstat (limited to 'lib/extensions')
-rw-r--r-- | lib/extensions/discord-akairo/BushCommand.ts | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/lib/extensions/discord-akairo/BushCommand.ts b/lib/extensions/discord-akairo/BushCommand.ts index dc2295f..7201248 100644 --- a/lib/extensions/discord-akairo/BushCommand.ts +++ b/lib/extensions/discord-akairo/BushCommand.ts @@ -32,6 +32,7 @@ import { } from 'discord-akairo'; import { Message, + PermissionsBitField, User, type ApplicationCommandOptionChoiceData, // eslint-disable-next-line @typescript-eslint/no-unused-vars @@ -495,6 +496,16 @@ export abstract class BushCommand extends Command { } } + if ( + 'userPermissions' in newOptions && + !('slashDefaultMemberPermissions' in newOptions) && + typeof newOptions.userPermissions !== 'function' + ) { + const perms = new PermissionsBitField(newOptions.userPermissions); + + newOptions.slashDefaultMemberPermissions = perms.toArray().length === 0 ? null : perms; + } + super(id, newOptions); if (options_.args ?? options_.helpArgs) { |