aboutsummaryrefslogtreecommitdiff
path: root/src/inhibitors/blacklist/userBlacklist.ts
blob: 01563a0adccf322fc1b5a095dc17faf2b21045aa (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;
		}
	}
}