aboutsummaryrefslogtreecommitdiff
path: root/src/arguments/permission.ts
blob: 8c090721c772cb296d07395f751e055e22bf3e81 (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 (!(phrase in Permissions.FLAGS)) {
		return null;
	} else {
		return phrase;
	}
};