aboutsummaryrefslogtreecommitdiff
path: root/src/inhibitors/blacklist/userBlacklist.ts
blob: f3cc642735ba84112d7c4d5566ee1300f76b7d78 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
import { BushInhibitor, BushMessage, BushSlashMessage } from '@lib';

export default class UserBlacklistInhibitor extends BushInhibitor {
	public constructor() {
		super('userBlacklist', {
			reason: 'userBlacklist',
			category: 'blacklist',
			type: 'all'
		});
	}

	public exec(message: BushMessage | BushSlashMessage): boolean {
		if (!message.author) return false;
		if (this.client.isOwner(message.author) || this.client.isSuperUser(message.author)) return false;
		if (this.client.cache.global.blacklistedUsers.includes(message.author.id)) {
			this.client.console.debug(`UserBlacklistInhibitor blocked message.`);
			return true;
		}
	}
}