diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/commands/info/userInfo.ts | 10 | ||||
-rw-r--r-- | src/lib/utils/BushConstants.ts | 5 | ||||
-rw-r--r-- | src/listeners/commands/commandMissingPermissions.ts | 12 |
3 files changed, 10 insertions, 17 deletions
diff --git a/src/commands/info/userInfo.ts b/src/commands/info/userInfo.ts index 4e60f4c..9450e96 100644 --- a/src/commands/info/userInfo.ts +++ b/src/commands/info/userInfo.ts @@ -169,12 +169,10 @@ export default class UserInfoCommand extends BushCommand { const perms = []; if (member?.permissions.has('ADMINISTRATOR') || message.guild?.ownerId == user.id) { perms.push('`Administrator`'); - } else if (member?.permissions.toArray(true).length) { - member.permissions.toArray(true).forEach((permission) => { - if (client.consts.mappings.permissions[permission as keyof typeof client.consts.mappings.permissions]?.important) { - perms.push( - `\`${client.consts.mappings.permissions[permission as keyof typeof client.consts.mappings.permissions].name}\`` - ); + } else if (member?.permissions.toArray(false).length) { + member.permissions.toArray(false).forEach((permission) => { + if (client.consts.mappings.permissions[permission]?.important) { + perms.push(`\`${client.consts.mappings.permissions[permission].name}\``); } }); } diff --git a/src/lib/utils/BushConstants.ts b/src/lib/utils/BushConstants.ts index 5698b67..a8f75fa 100644 --- a/src/lib/utils/BushConstants.ts +++ b/src/lib/utils/BushConstants.ts @@ -219,12 +219,13 @@ export class BushConstants { MANAGE_NICKNAMES: { name: 'Change Nicknames', important: true }, MANAGE_ROLES: { name: 'Manage Roles', important: true }, MANAGE_WEBHOOKS: { name: 'Manage Webhooks', important: true }, - MANAGE_EMOJIS: { name: 'Manage Emojis', important: true }, + MANAGE_EMOJIS_AND_STICKERS: { name: 'Manage Emojis and Stickers', important: true }, USE_APPLICATION_COMMANDS: { name: 'Use Slash Commands', important: false }, REQUEST_TO_SPEAK: { name: 'Request to Speak', important: false }, + MANAGE_THREADS: { name: 'Manage Threads', important: true }, USE_PUBLIC_THREADS: { name: 'Use public Threads', important: false }, USE_PRIVATE_THREADS: { name: 'Use Private Threads', important: false }, - MANAGE_THREADS: { name: 'Manage Threads', important: true } + USE_EXTERNAL_STICKERS: { name: 'Use External Stickers', important: false } }, // prettier-ignore diff --git a/src/listeners/commands/commandMissingPermissions.ts b/src/listeners/commands/commandMissingPermissions.ts index 49a2e7a..7d69456 100644 --- a/src/listeners/commands/commandMissingPermissions.ts +++ b/src/listeners/commands/commandMissingPermissions.ts @@ -1,5 +1,4 @@ import { BushCommandHandlerEvents, BushListener } from '@lib'; -import { PermissionString } from 'discord.js'; export default class CommandMissingPermissionsListener extends BushListener { public constructor() { @@ -21,14 +20,9 @@ export default class CommandMissingPermissionsListener extends BushListener { | BushCommandHandlerEvents['missingPermissions'] | BushCommandHandlerEvents['slashMissingPermissions'] ): Promise<unknown> { - const niceMissing: string[] = []; - missing.forEach((missing: PermissionString) => { - if (client.consts.mappings.permissions[missing as keyof typeof client.consts.mappings.permissions]) { - niceMissing.push(client.consts.mappings.permissions[missing as keyof typeof client.consts.mappings.permissions].name); - } else { - niceMissing.push(missing); - } - }); + const niceMissing = missing.includes('ADMINISTRATOR') + ? ['ADMINISTRATOR'] + : missing.map((perm) => client.consts.mappings.permissions[perm]?.name ?? missing); const discordFormat = util.oxford(util.surroundArray(niceMissing, '**'), 'and', ''); const consoleFormat = util.oxford(util.surroundArray(niceMissing, '<<', '>>'), 'and', ''); |