diff options
author | IRONM00N <64110067+IRONM00N@users.noreply.github.com> | 2022-06-17 20:03:05 -0400 |
---|---|---|
committer | IRONM00N <64110067+IRONM00N@users.noreply.github.com> | 2022-06-17 20:03:05 -0400 |
commit | e1c613829950a534d9f45c00a033b83575be3b3c (patch) | |
tree | 2de1e5231217211ae4087c46cc74dc46c584507a /src/inhibitors | |
parent | 0e87bbd3940d89defcb04926587b35c8f4d1947f (diff) | |
download | tanzanite-e1c613829950a534d9f45c00a033b83575be3b3c.tar.gz tanzanite-e1c613829950a534d9f45c00a033b83575be3b3c.tar.bz2 tanzanite-e1c613829950a534d9f45c00a033b83575be3b3c.zip |
remove global client variable
Diffstat (limited to 'src/inhibitors')
-rw-r--r-- | src/inhibitors/blacklist/channelGlobalBlacklist.ts | 6 | ||||
-rw-r--r-- | src/inhibitors/blacklist/channelGuildBlacklist.ts | 4 | ||||
-rw-r--r-- | src/inhibitors/blacklist/guildBlacklist.ts | 10 | ||||
-rw-r--r-- | src/inhibitors/blacklist/userGlobalBlacklist.ts | 6 | ||||
-rw-r--r-- | src/inhibitors/blacklist/userGuildBlacklist.ts | 8 | ||||
-rw-r--r-- | src/inhibitors/checks/fatal.ts | 9 | ||||
-rw-r--r-- | src/inhibitors/checks/guildUnavailable.ts | 2 | ||||
-rw-r--r-- | src/inhibitors/command/dm.ts | 2 | ||||
-rw-r--r-- | src/inhibitors/command/globalDisabledCommand.ts | 4 | ||||
-rw-r--r-- | src/inhibitors/command/guild.ts | 2 | ||||
-rw-r--r-- | src/inhibitors/command/guildDisabledCommand.ts | 2 | ||||
-rw-r--r-- | src/inhibitors/command/nsfw.ts | 2 | ||||
-rw-r--r-- | src/inhibitors/command/owner.ts | 4 | ||||
-rw-r--r-- | src/inhibitors/command/restrictedChannel.ts | 2 | ||||
-rw-r--r-- | src/inhibitors/command/restrictedGuild.ts | 2 | ||||
-rw-r--r-- | src/inhibitors/command/superUser.ts | 4 |
16 files changed, 39 insertions, 30 deletions
diff --git a/src/inhibitors/blacklist/channelGlobalBlacklist.ts b/src/inhibitors/blacklist/channelGlobalBlacklist.ts index 86ab21f..7f23604 100644 --- a/src/inhibitors/blacklist/channelGlobalBlacklist.ts +++ b/src/inhibitors/blacklist/channelGlobalBlacklist.ts @@ -13,9 +13,9 @@ export default class UserGlobalBlacklistInhibitor extends BushInhibitor { public exec(message: CommandMessage | SlashMessage, command: BushCommand): boolean { if (!message.author || !message.inGuild()) return false; // do not change to message.author.isOwner() - if (client.isOwner(message.author) || client.user!.id === message.author.id) return false; - if (client.cache.global.blacklistedChannels.includes(message.channel!.id) && !command.bypassChannelBlacklist) { - void client.console.verbose( + if (this.client.isOwner(message.author) || this.client.user!.id === message.author.id) return false; + if (this.client.cache.global.blacklistedChannels.includes(message.channel!.id) && !command.bypassChannelBlacklist) { + void this.client.console.verbose( 'channelGlobalBlacklist', `Blocked message with id <<${message.id}>> from <<${message.author.tag}>> in <<${message.guild.name}>>.` ); diff --git a/src/inhibitors/blacklist/channelGuildBlacklist.ts b/src/inhibitors/blacklist/channelGuildBlacklist.ts index 8cf35ec..ae087bd 100644 --- a/src/inhibitors/blacklist/channelGuildBlacklist.ts +++ b/src/inhibitors/blacklist/channelGuildBlacklist.ts @@ -13,7 +13,7 @@ export default class ChannelGuildBlacklistInhibitor extends BushInhibitor { public async exec(message: CommandMessage | SlashMessage, command: BushCommand): Promise<boolean> { if (!message.author || !message.inGuild()) return false; // do not change to message.author.isOwner() - if (client.isOwner(message.author) || client.user!.id === message.author.id) return false; + if (this.client.isOwner(message.author) || this.client.user!.id === message.author.id) return false; if ( (await message.guild.getSetting('bypassChannelBlacklist'))?.includes(message.author.id) && !command.bypassChannelBlacklist @@ -24,7 +24,7 @@ export default class ChannelGuildBlacklistInhibitor extends BushInhibitor { (await message.guild.getSetting('blacklistedChannels'))?.includes(message.channel!.id) && !command.bypassChannelBlacklist ) { - void client.console.verbose( + void this.client.console.verbose( 'channelGuildBlacklist', `Blocked message with id <<${message.id}>> from <<${message.author.tag}>> in <<${message.guild.name}>>.` ); diff --git a/src/inhibitors/blacklist/guildBlacklist.ts b/src/inhibitors/blacklist/guildBlacklist.ts index 60c5755..b7df41a 100644 --- a/src/inhibitors/blacklist/guildBlacklist.ts +++ b/src/inhibitors/blacklist/guildBlacklist.ts @@ -13,10 +13,14 @@ export default class GuildBlacklistInhibitor extends BushInhibitor { public exec(message: CommandMessage | SlashMessage): boolean { if (!message.author || !message.inGuild()) return false; // do not change to message.author.isOwner() - if (client.isOwner(message.author) || client.isSuperUser(message.author) || client.user!.id === message.author.id) + if ( + this.client.isOwner(message.author) || + this.client.isSuperUser(message.author) || + this.client.user!.id === message.author.id + ) return false; - if (client.cache.global.blacklistedGuilds.includes(message.guild.id)) { - void client.console.verbose( + if (this.client.cache.global.blacklistedGuilds.includes(message.guild.id)) { + void this.client.console.verbose( 'guildBlacklist', `Blocked message with id <<${message.id}>> from <<${message.author.tag}>> in <<${message.guild.name}>>.` ); diff --git a/src/inhibitors/blacklist/userGlobalBlacklist.ts b/src/inhibitors/blacklist/userGlobalBlacklist.ts index bf0d4bd..e8a1306 100644 --- a/src/inhibitors/blacklist/userGlobalBlacklist.ts +++ b/src/inhibitors/blacklist/userGlobalBlacklist.ts @@ -13,9 +13,9 @@ export default class UserGlobalBlacklistInhibitor extends BushInhibitor { public exec(message: CommandMessage | SlashMessage): boolean { if (!message.author) return false; // do not change to message.author.isOwner() - if (client.isOwner(message.author) || client.user!.id === message.author.id) return false; - if (client.cache.global.blacklistedUsers.includes(message.author.id)) { - void client.console.verbose( + if (this.client.isOwner(message.author) || this.client.user!.id === message.author.id) return false; + if (this.client.cache.global.blacklistedUsers.includes(message.author.id)) { + void this.client.console.verbose( 'userGlobalBlacklist', `Blocked message with id <<${message.id}>> from <<${message.author.tag}>> in <<${ message.inGuild() ? message.guild?.name : message.author.tag diff --git a/src/inhibitors/blacklist/userGuildBlacklist.ts b/src/inhibitors/blacklist/userGuildBlacklist.ts index a2ac1aa..a661606 100644 --- a/src/inhibitors/blacklist/userGuildBlacklist.ts +++ b/src/inhibitors/blacklist/userGuildBlacklist.ts @@ -13,10 +13,14 @@ export default class UserGuildBlacklistInhibitor extends BushInhibitor { public async exec(message: CommandMessage | SlashMessage): Promise<boolean> { if (!message.author || !message.inGuild()) return false; // do not change to message.author.isOwner() - if (client.isOwner(message.author) || client.isSuperUser(message.author) || client.user!.id === message.author.id) + if ( + this.client.isOwner(message.author) || + this.client.isSuperUser(message.author) || + this.client.user!.id === message.author.id + ) return false; if ((await message.guild.getSetting('blacklistedUsers'))?.includes(message.author.id)) { - void client.console.verbose( + void this.client.console.verbose( 'userGuildBlacklist', `Blocked message with id <<${message.id}>> from <<${message.author.tag}>> in <<${message.guild.name}>>.` ); diff --git a/src/inhibitors/checks/fatal.ts b/src/inhibitors/checks/fatal.ts index a3601b5..9fda504 100644 --- a/src/inhibitors/checks/fatal.ts +++ b/src/inhibitors/checks/fatal.ts @@ -12,10 +12,11 @@ export default class FatalInhibitor extends BushInhibitor { } public async exec(message: Message | SlashMessage): Promise<boolean> { - if (client.isOwner(message.author)) return false; - for (const property in client.cache.global) { - if (!client.cache.global[property as keyof typeof client.cache.global]) { - void client.console.verbose( + if (this.client.isOwner(message.author)) return false; + const globalCache = this.client.cache.global; + for (const property in globalCache) { + if (!globalCache[property as keyof typeof globalCache]) { + void this.client.console.verbose( 'fatal', `Blocked message with id <<${message.id}>> from <<${message.author.tag}>> in <<${message.guild?.name}>>.` ); diff --git a/src/inhibitors/checks/guildUnavailable.ts b/src/inhibitors/checks/guildUnavailable.ts index 6c741a1..f5b62f4 100644 --- a/src/inhibitors/checks/guildUnavailable.ts +++ b/src/inhibitors/checks/guildUnavailable.ts @@ -13,7 +13,7 @@ export default class GuildUnavailableInhibitor extends BushInhibitor { public async exec(message: Message | SlashMessage): Promise<boolean> { if (message.inGuild() && !message.guild.available) { - void client.console.verbose( + void this.client.console.verbose( 'guildUnavailable', `Blocked message with id <<${message.id}>> from <<${message.author.tag}>> in <<${message.guild.name}>>.` ); diff --git a/src/inhibitors/command/dm.ts b/src/inhibitors/command/dm.ts index 1fc43c6..5516c81 100644 --- a/src/inhibitors/command/dm.ts +++ b/src/inhibitors/command/dm.ts @@ -12,7 +12,7 @@ export default class DMInhibitor extends BushInhibitor { public async exec(message: CommandMessage | SlashMessage, command: BushCommand): Promise<boolean> { if (command.channel === 'dm' && message.guild) { - void client.console.verbose( + void this.client.console.verbose( 'dm', `Blocked message with id <<${message.id}>> from <<${message.author.tag}>> in <<${message.guild.name}>>.` ); diff --git a/src/inhibitors/command/globalDisabledCommand.ts b/src/inhibitors/command/globalDisabledCommand.ts index 7e855ae..f013183 100644 --- a/src/inhibitors/command/globalDisabledCommand.ts +++ b/src/inhibitors/command/globalDisabledCommand.ts @@ -12,8 +12,8 @@ export default class DisabledGuildCommandInhibitor extends BushInhibitor { public async exec(message: CommandMessage | SlashMessage, command: BushCommand): Promise<boolean> { if (message.author.isOwner()) return false; - if (client.cache.global.disabledCommands.includes(command?.id)) { - void client.console.verbose( + if (this.client.cache.global.disabledCommands.includes(command?.id)) { + void this.client.console.verbose( 'disabledGlobalCommand', `Blocked message with id <<${message.id}>> from <<${message.author.tag}>> in <<${message.guild?.name}>>.` ); diff --git a/src/inhibitors/command/guild.ts b/src/inhibitors/command/guild.ts index 6ea4e6a..ea52d99 100644 --- a/src/inhibitors/command/guild.ts +++ b/src/inhibitors/command/guild.ts @@ -12,7 +12,7 @@ export default class GuildInhibitor extends BushInhibitor { public async exec(message: CommandMessage | SlashMessage, command: BushCommand): Promise<boolean> { if (command.channel === 'guild' && !message.guild) { - void client.console.verbose( + void this.client.console.verbose( 'guild', `Blocked message with id <<${message.id}>> from <<${message.author.tag}>> in <<${message.author.tag}>>.` ); diff --git a/src/inhibitors/command/guildDisabledCommand.ts b/src/inhibitors/command/guildDisabledCommand.ts index 7d63093..7fef78a 100644 --- a/src/inhibitors/command/guildDisabledCommand.ts +++ b/src/inhibitors/command/guildDisabledCommand.ts @@ -15,7 +15,7 @@ export default class DisabledGuildCommandInhibitor extends BushInhibitor { if (message.author.isOwner() || message.author.isSuperUser()) return false; // super users bypass guild disabled commands if ((await message.guild.getSetting('disabledCommands'))?.includes(command?.id)) { - void client.console.verbose( + void this.client.console.verbose( 'disabledGuildCommand', `Blocked message with id <<${message.id}>> from <<${message.author.tag}>> in <<${message.guild.name}>>.` ); diff --git a/src/inhibitors/command/nsfw.ts b/src/inhibitors/command/nsfw.ts index f8f2180..ed55b00 100644 --- a/src/inhibitors/command/nsfw.ts +++ b/src/inhibitors/command/nsfw.ts @@ -13,7 +13,7 @@ export default class NsfwInhibitor extends BushInhibitor { public async exec(message: CommandMessage | SlashMessage, command: BushCommand): Promise<boolean> { if (command.onlyNsfw && !(message.channel as TextChannel).nsfw) { - void client.console.verbose( + void this.client.console.verbose( 'notNsfw', `Blocked message with id <<${message.id}>> from <<${message.author.tag}>> in <<${message.guild?.name}>>.` ); diff --git a/src/inhibitors/command/owner.ts b/src/inhibitors/command/owner.ts index 3769d84..7a39063 100644 --- a/src/inhibitors/command/owner.ts +++ b/src/inhibitors/command/owner.ts @@ -12,8 +12,8 @@ export default class OwnerInhibitor extends BushInhibitor { public async exec(message: CommandMessage | SlashMessage, command: BushCommand): Promise<boolean> { if (command.ownerOnly) { - if (!client.isOwner(message.author)) { - void client.console.verbose( + if (!this.client.isOwner(message.author)) { + void this.client.console.verbose( 'owner', `Blocked message with id <<${message.id}>> from <<${message.author.tag}>> in <<${message.guild?.name}>>.` ); diff --git a/src/inhibitors/command/restrictedChannel.ts b/src/inhibitors/command/restrictedChannel.ts index 867756d..849166a 100644 --- a/src/inhibitors/command/restrictedChannel.ts +++ b/src/inhibitors/command/restrictedChannel.ts @@ -13,7 +13,7 @@ export default class RestrictedChannelInhibitor extends BushInhibitor { public async exec(message: CommandMessage | SlashMessage, command: BushCommand): Promise<boolean> { if (command.restrictedChannels?.length && message.channel) { if (!command.restrictedChannels.includes(message.channel.id)) { - void client.console.verbose( + void this.client.console.verbose( 'restrictedChannel', `Blocked message with id <<${message.id}>> from <<${message.author.tag}>> in <<${message.guild?.name}>>.` ); diff --git a/src/inhibitors/command/restrictedGuild.ts b/src/inhibitors/command/restrictedGuild.ts index 4d43c21..1e2d1b2 100644 --- a/src/inhibitors/command/restrictedGuild.ts +++ b/src/inhibitors/command/restrictedGuild.ts @@ -13,7 +13,7 @@ export default class RestrictedGuildInhibitor extends BushInhibitor { public async exec(message: CommandMessage | SlashMessage, command: BushCommand): Promise<boolean> { if (command.restrictedChannels?.length && message.channel) { if (!command.restrictedChannels.includes(message.channel.id)) { - void client.console.verbose( + void this.client.console.verbose( 'restrictedGuild', `Blocked message with id <<${message.id}>> from <<${message.author.tag}>> in <<${message.guild?.name}>>.` ); diff --git a/src/inhibitors/command/superUser.ts b/src/inhibitors/command/superUser.ts index 2e44b67..69e95a2 100644 --- a/src/inhibitors/command/superUser.ts +++ b/src/inhibitors/command/superUser.ts @@ -12,8 +12,8 @@ export default class SuperUserInhibitor extends BushInhibitor { public async exec(message: CommandMessage | SlashMessage, command: BushCommand): Promise<boolean> { if (command.superUserOnly) { - if (!client.isSuperUser(message.author)) { - void client.console.verbose( + if (!this.client.isSuperUser(message.author)) { + void this.client.console.verbose( 'superUser', `Blocked message with id <<${message.id}>> from <<${message.author.tag}>> in <<${message.guild?.name}>>.` ); |