diff options
| author | IRONM00N <64110067+IRONM00N@users.noreply.github.com> | 2021-06-29 20:48:27 -0400 |
|---|---|---|
| committer | IRONM00N <64110067+IRONM00N@users.noreply.github.com> | 2021-06-29 20:48:27 -0400 |
| commit | fd675ca9d60cc06d892ebc36a1b9624f15233f20 (patch) | |
| tree | 0c510afb64eb2c6f45c15c7e22148c6e7f7ed2d7 /src/lib/extensions/BushCommandHandler.ts | |
| parent | 921b07f9716fdd413ec89c4a40419a6e2d39824b (diff) | |
| download | tanzanite-fd675ca9d60cc06d892ebc36a1b9624f15233f20.tar.gz tanzanite-fd675ca9d60cc06d892ebc36a1b9624f15233f20.tar.bz2 tanzanite-fd675ca9d60cc06d892ebc36a1b9624f15233f20.zip | |
don't judge part 1
Diffstat (limited to 'src/lib/extensions/BushCommandHandler.ts')
| -rw-r--r-- | src/lib/extensions/BushCommandHandler.ts | 91 |
1 files changed, 0 insertions, 91 deletions
diff --git a/src/lib/extensions/BushCommandHandler.ts b/src/lib/extensions/BushCommandHandler.ts deleted file mode 100644 index aeea101..0000000 --- a/src/lib/extensions/BushCommandHandler.ts +++ /dev/null @@ -1,91 +0,0 @@ -/* eslint-disable @typescript-eslint/no-explicit-any */ -import { Category, CommandHandler, CommandHandlerOptions } from 'discord-akairo'; -import { Collection } from 'discord.js'; -import { BushConstants } from '../utils/BushConstants'; -import { BushClient } from './BushClient'; -import { BushCommand } from './BushCommand'; -import { BushMessage } from './BushMessage'; - -export type BushCommandHandlerOptions = CommandHandlerOptions; - -const CommandHandlerEvents = BushConstants.CommandHandlerEvents; -const BlockedReasons = BushConstants.BlockedReasons; - -export class BushCommandHandler extends CommandHandler { - public declare client: BushClient; - public declare modules: Collection<string, BushCommand>; - public declare categories: Collection<string, Category<string, BushCommand>>; - public constructor(client: BushClient, options: CommandHandlerOptions) { - super(client, options); - this.client = client; - } - - public async runPostTypeInhibitors(message: BushMessage, command: BushCommand, slash = false): Promise<boolean> { - if (command.ownerOnly) { - const isOwner = this.client.isOwner(message.author); - if (!isOwner) { - this.emit( - slash ? CommandHandlerEvents.SLASH_BLOCKED : CommandHandlerEvents.COMMAND_BLOCKED, - message, - command, - BlockedReasons.OWNER - ); - return true; - } - } - - if (command.superUserOnly) { - const isSuperUser = this.client.isSuperUser(message.author); - if (!isSuperUser) { - this.emit( - slash ? CommandHandlerEvents.SLASH_BLOCKED : CommandHandlerEvents.COMMAND_BLOCKED, - message, - command, - BlockedReasons.OWNER - ); - return true; - } - } - - if (command.channel === 'guild' && !message.guild) { - this.emit( - slash ? CommandHandlerEvents.SLASH_BLOCKED : CommandHandlerEvents.COMMAND_BLOCKED, - message, - command, - BlockedReasons.GUILD - ); - return true; - } - - if (command.channel === 'dm' && message.guild) { - this.emit( - slash ? CommandHandlerEvents.SLASH_BLOCKED : CommandHandlerEvents.COMMAND_BLOCKED, - message, - command, - BlockedReasons.DM - ); - return true; - } - if (command.restrictedChannels?.length && message.channel) { - if (!command.restrictedChannels.includes(message.channel.id)) { - this.emit(CommandHandlerEvents.COMMAND_BLOCKED, message, command, BlockedReasons.RESTRICTED_CHANNEL); - return true; - } - } - if (command.restrictedGuilds?.length && message.guild) { - if (!command.restrictedGuilds.includes(message.guild.id)) { - this.emit(CommandHandlerEvents.COMMAND_BLOCKED, message, command, BlockedReasons.RESTRICTED_GUILD); - return true; - } - } - if (await this.runPermissionChecks(message, command)) { - return true; - } - const reason = this.inhibitorHandler ? await this.inhibitorHandler.test('post', message, command) : null; - if (reason != null) { - this.emit(CommandHandlerEvents.COMMAND_BLOCKED, message, command, reason); - return true; - } - return !!this.runCooldowns(message, command); - } -} |
