aboutsummaryrefslogtreecommitdiff
path: root/src/arguments/permission.ts
blob: 36c8fcb5b564388435e950dfd40629ca137e9cd7 (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 permission: BushArgumentTypeCaster = (_, phrase) => {
	if (!phrase) return null;
	phrase = phrase.toUpperCase().replace(/ /g, '_');
	if (!Reflect.has(Permissions.FLAGS, phrase)) {
		return null;
	} else {
		return phrase;
	}
};