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

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