diff options
author | IRONM00N <64110067+IRONM00N@users.noreply.github.com> | 2021-09-30 16:48:07 -0400 |
---|---|---|
committer | IRONM00N <64110067+IRONM00N@users.noreply.github.com> | 2021-09-30 16:48:07 -0400 |
commit | 42d2e2bf01b5debd4ecf605297f925ad5da7deb3 (patch) | |
tree | daf6678542cd8735f9930086f7a1e76ae6884e4e /src/lib/extensions/discord-akairo/BushCommand.ts | |
parent | 4ad90b19851a0853287c45d326a28be535b1607f (diff) | |
download | tanzanite-42d2e2bf01b5debd4ecf605297f925ad5da7deb3.tar.gz tanzanite-42d2e2bf01b5debd4ecf605297f925ad5da7deb3.tar.bz2 tanzanite-42d2e2bf01b5debd4ecf605297f925ad5da7deb3.zip |
I did this 2 weeks ago idk what I did
Diffstat (limited to 'src/lib/extensions/discord-akairo/BushCommand.ts')
-rw-r--r-- | src/lib/extensions/discord-akairo/BushCommand.ts | 29 |
1 files changed, 20 insertions, 9 deletions
diff --git a/src/lib/extensions/discord-akairo/BushCommand.ts b/src/lib/extensions/discord-akairo/BushCommand.ts index 1c8ea5b..073221d 100644 --- a/src/lib/extensions/discord-akairo/BushCommand.ts +++ b/src/lib/extensions/discord-akairo/BushCommand.ts @@ -1,5 +1,5 @@ import { ArgumentOptions, ArgumentPromptOptions, ArgumentTypeCaster, Command, CommandOptions } from 'discord-akairo'; -import { Snowflake } from 'discord.js'; +import { PermissionResolvable, Snowflake } from 'discord.js'; import { BushMessage } from '../discord.js/BushMessage'; import { BushClient } from './BushClient'; import { BushCommandHandler } from './BushCommandHandler'; @@ -136,7 +136,9 @@ export interface CustomBushArgumentOptions extends BaseBushArgumentOptions { customType?: ArgumentTypeCaster | (string | string[])[] | RegExp | string | null; } -export interface BushCommandOptions extends CommandOptions { +export type BushMissingPermissionSupplier = (message: BushMessage | BushSlashMessage) => Promise<any> | any; + +export interface BushCommandOptions extends Omit<CommandOptions, 'userPermissions' | 'clientPermissions'> { hidden?: boolean; restrictedChannels?: Snowflake[]; restrictedGuilds?: Snowflake[]; @@ -148,6 +150,9 @@ export interface BushCommandOptions extends CommandOptions { args?: BushArgumentOptions[] & CustomBushArgumentOptions[]; category: string; pseudo?: boolean; + bypassChannelBlacklist?: boolean; + clientPermissions?: PermissionResolvable | PermissionResolvable[] | BushMissingPermissionSupplier; + userPermissions?: PermissionResolvable | PermissionResolvable[] | BushMissingPermissionSupplier; } export class BushCommand extends Command { @@ -155,13 +160,14 @@ export class BushCommand extends Command { public declare handler: BushCommandHandler; + /** The command's options */ public options: BushCommandOptions; /** The channels the command is limited to run in. */ - public restrictedChannels: Snowflake[]; + public restrictedChannels: Snowflake[] | undefined; /** The guilds the command is limited to run in. */ - public restrictedGuilds: Snowflake[]; + public restrictedGuilds: Snowflake[] | undefined; /** Whether the command is hidden from the help command. */ public hidden: boolean; @@ -169,6 +175,9 @@ export class BushCommand extends Command { /** A fake command, completely hidden from the help command. */ public pseudo: boolean; + /** Allow this command to be run in channels that are blacklisted. */ + public bypassChannelBlacklist: boolean; + public constructor(id: string, options: BushCommandOptions) { if (options.args && typeof options.args !== 'function') { options.args.forEach((_, index: number) => { @@ -179,12 +188,14 @@ export class BushCommand extends Command { } }); } - super(id, options); + // incompatible options + super(id, options as any); this.options = options; - this.hidden = options.hidden ?? false; - this.restrictedChannels = options.restrictedChannels!; - this.restrictedGuilds = options.restrictedGuilds!; - this.pseudo = options.pseudo!; + this.hidden = Boolean(options.hidden); + this.restrictedChannels = options.restrictedChannels; + this.restrictedGuilds = options.restrictedGuilds; + this.pseudo = Boolean(options.pseudo); + this.bypassChannelBlacklist = Boolean(options.bypassChannelBlacklist); } public override exec(message: BushMessage, args: any): any; |