aboutsummaryrefslogtreecommitdiff
path: root/src/inhibitors
diff options
context:
space:
mode:
Diffstat (limited to 'src/inhibitors')
-rw-r--r--src/inhibitors/blacklist/guildBlacklist.ts7
-rw-r--r--src/inhibitors/blacklist/userBlacklist.ts7
-rw-r--r--src/inhibitors/commands/disabledCommand.ts7
-rw-r--r--src/inhibitors/noCache.ts9
4 files changed, 21 insertions, 9 deletions
diff --git a/src/inhibitors/blacklist/guildBlacklist.ts b/src/inhibitors/blacklist/guildBlacklist.ts
index 103e89b..04f496a 100644
--- a/src/inhibitors/blacklist/guildBlacklist.ts
+++ b/src/inhibitors/blacklist/guildBlacklist.ts
@@ -3,7 +3,7 @@ import { BushSlashMessage } from '../../lib/extensions/discord-akairo/BushSlashM
import { BushMessage } from '../../lib/extensions/discord.js/BushMessage';
export default class GuildBlacklistInhibitor extends BushInhibitor {
- constructor() {
+ public constructor() {
super('guildBlacklist', {
reason: 'guildBlacklist',
category: 'blacklist',
@@ -14,6 +14,9 @@ export default class GuildBlacklistInhibitor extends BushInhibitor {
public exec(message: BushMessage | BushSlashMessage): boolean {
if (!message.guild) return false;
if (message.author && (this.client.isOwner(message.author) || this.client.isSuperUser(message.author))) return false;
- return this.client.cache.global.blacklistedGuilds.includes(message.guild.id);
+ if (this.client.cache.global.blacklistedGuilds.includes(message.guild.id)) {
+ this.client.console.debug(`GuildBlacklistInhibitor blocked message.`);
+ return true;
+ }
}
}
diff --git a/src/inhibitors/blacklist/userBlacklist.ts b/src/inhibitors/blacklist/userBlacklist.ts
index 6772188..4349bb1 100644
--- a/src/inhibitors/blacklist/userBlacklist.ts
+++ b/src/inhibitors/blacklist/userBlacklist.ts
@@ -3,7 +3,7 @@ import { BushSlashMessage } from '../../lib/extensions/discord-akairo/BushSlashM
import { BushMessage } from '../../lib/extensions/discord.js/BushMessage';
export default class UserBlacklistInhibitor extends BushInhibitor {
- constructor() {
+ public constructor() {
super('userBlacklist', {
reason: 'userBlacklist',
category: 'blacklist',
@@ -14,6 +14,9 @@ export default class UserBlacklistInhibitor extends BushInhibitor {
public exec(message: BushMessage | BushSlashMessage): boolean {
if (!message.author) return false;
if (this.client.isOwner(message.author) || this.client.isSuperUser(message.author)) return false;
- return this.client.cache.global.blacklistedUsers.includes(message.author.id);
+ if (this.client.cache.global.blacklistedUsers.includes(message.author.id)) {
+ this.client.console.debug(`UserBlacklistInhibitor blocked message.`);
+ return true;
+ }
}
}
diff --git a/src/inhibitors/commands/disabledCommand.ts b/src/inhibitors/commands/disabledCommand.ts
index 5b47ce3..6936a41 100644
--- a/src/inhibitors/commands/disabledCommand.ts
+++ b/src/inhibitors/commands/disabledCommand.ts
@@ -4,7 +4,7 @@ import { BushSlashMessage } from '../../lib/extensions/discord-akairo/BushSlashM
import { BushMessage } from '../../lib/extensions/discord.js/BushMessage';
export default class DisabledCommandInhibitor extends BushInhibitor {
- constructor() {
+ public constructor() {
super('disabledCommand', {
reason: 'disabled',
type: 'pre',
@@ -14,6 +14,9 @@ export default class DisabledCommandInhibitor extends BushInhibitor {
public async exec(message: BushMessage | BushSlashMessage, command: BushCommand): Promise<boolean> {
if (this.client.isOwner(message.author)) return false;
- return this.client.cache.global.disabledCommands.includes(command?.id);
+ if (this.client.cache.global.disabledCommands.includes(command?.id)) {
+ this.client.console.debug(`DisabledCommandInhibitor blocked message.`);
+ return true;
+ }
}
}
diff --git a/src/inhibitors/noCache.ts b/src/inhibitors/noCache.ts
index fe2e522..db46801 100644
--- a/src/inhibitors/noCache.ts
+++ b/src/inhibitors/noCache.ts
@@ -2,8 +2,8 @@ import { BushInhibitor } from '../lib/extensions/discord-akairo/BushInhibitor';
import { BushSlashMessage } from '../lib/extensions/discord-akairo/BushSlashMessage';
import { BushMessage } from '../lib/extensions/discord.js/BushMessage';
-export default class noCacheInhibitor extends BushInhibitor {
- constructor() {
+export default class NoCacheInhibitor extends BushInhibitor {
+ public constructor() {
super('noCache', {
reason: 'noCache',
type: 'all',
@@ -14,7 +14,10 @@ export default class noCacheInhibitor extends BushInhibitor {
public async exec(message: BushMessage | BushSlashMessage): Promise<boolean> {
if (this.client.isOwner(message.author)) return false;
for (const property in this.client.cache) {
- if (property === undefined || property === null) return true;
+ if (property === undefined || property === null) {
+ this.client.console.debug(`NoCacheInhibitor blocked message.`);
+ return true;
+ }
}
return false;
}