aboutsummaryrefslogtreecommitdiff
path: root/src/listeners
diff options
context:
space:
mode:
authorIRONM00N <64110067+IRONM00N@users.noreply.github.com>2021-09-03 19:40:41 -0400
committerIRONM00N <64110067+IRONM00N@users.noreply.github.com>2021-09-03 19:40:41 -0400
commitaeba835858f3426c5de31434b5d1f4056606a828 (patch)
tree14790964c0ef64ccaf43c5d6692544cdedba6c72 /src/listeners
parent303938bf3bcce033f9feb8324410bbc0ef83e466 (diff)
downloadtanzanite-aeba835858f3426c5de31434b5d1f4056606a828.tar.gz
tanzanite-aeba835858f3426c5de31434b5d1f4056606a828.tar.bz2
tanzanite-aeba835858f3426c5de31434b5d1f4056606a828.zip
fix permissions
Diffstat (limited to 'src/listeners')
-rw-r--r--src/listeners/commands/commandMissingPermissions.ts12
1 files changed, 3 insertions, 9 deletions
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', '');