aboutsummaryrefslogtreecommitdiff
path: root/src/arguments/permission.ts
blob: 614a1c72e8ffc111b9f2d698026de49ef88d0348 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
import { type BushArgumentTypeCaster } from '@lib';
import { Permissions } from 'discord.js';

export const permissionTypeCaster: BushArgumentTypeCaster = (_, phrase) => {
	if (!phrase) return null;
	phrase = phrase.toUpperCase().replace(/ /g, '_');
	if (!Reflect.has(Permissions.FLAGS, phrase)) {
		return null;
	} else {
		return phrase;
	}
};