aboutsummaryrefslogtreecommitdiff
path: root/src/arguments/permission.ts
blob: bb042d5f0d926fd73fc61b8689800400b58d0319 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
import { 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;
	}
};