diff options
Diffstat (limited to 'src/lib')
-rw-r--r-- | src/lib/common/ButtonPaginator.ts | 9 | ||||
-rw-r--r-- | src/lib/common/util/Arg.ts | 7 | ||||
-rw-r--r-- | src/lib/extensions/discord-akairo/BushClientUtil.ts | 13 | ||||
-rw-r--r-- | src/lib/utils/BushConstants.ts | 6 |
4 files changed, 19 insertions, 16 deletions
diff --git a/src/lib/common/ButtonPaginator.ts b/src/lib/common/ButtonPaginator.ts index c74f6ad..68955cc 100644 --- a/src/lib/common/ButtonPaginator.ts +++ b/src/lib/common/ButtonPaginator.ts @@ -118,15 +118,12 @@ export class ButtonPaginator { } protected async end() { - try { - return this.sentMessage!.edit({ + if (!this.deleteOnExit) + return await this.sentMessage!.edit({ content: this.text, embeds: [this.embeds[this.curPage]], components: [this.getPaginationRow(true)] - }); - } catch (e) { - return undefined; - } + }).catch(() => undefined); } protected async edit(interaction: MessageComponentInteraction) { diff --git a/src/lib/common/util/Arg.ts b/src/lib/common/util/Arg.ts index 84d5aeb..d267eb9 100644 --- a/src/lib/common/util/Arg.ts +++ b/src/lib/common/util/Arg.ts @@ -1,4 +1,4 @@ -import { Argument, ArgumentTypeCaster, Flag, ParsedValuePredicate, TypeResolver } from 'discord-akairo'; +import { AkairoMessage, Argument, ArgumentTypeCaster, Flag, ParsedValuePredicate } from 'discord-akairo'; import { Message } from 'discord.js'; import { BushArgumentType } from '../..'; @@ -6,12 +6,11 @@ export class Arg { /** * Casts a phrase to this argument's type. * @param type - The type to cast to. - * @param resolver - The type resolver. * @param message - Message that called the command. * @param phrase - Phrase to process. */ - public static cast(type: BushArgumentType, resolver: TypeResolver, message: Message, phrase: string): Promise<any> { - return Argument.cast(type, resolver, message, phrase); + public static cast(type: BushArgumentType, message: Message | AkairoMessage, phrase: string): Promise<any> { + return Argument.cast(type, client.commandHandler.resolver, message as Message, phrase); } /** diff --git a/src/lib/extensions/discord-akairo/BushClientUtil.ts b/src/lib/extensions/discord-akairo/BushClientUtil.ts index 499d2c7..a833c75 100644 --- a/src/lib/extensions/discord-akairo/BushClientUtil.ts +++ b/src/lib/extensions/discord-akairo/BushClientUtil.ts @@ -223,12 +223,11 @@ export class BushClientUtil extends ClientUtil { * * Embed Description Limit = 4096 characters * * Embed Field Limit = 1024 characters */ - public async codeblock(code: string, length: number, language?: CodeBlockLang, substr = false): Promise<string> { + public async codeblock(code: string, length: number, language: CodeBlockLang | '' = '', substr = false): Promise<string> { let hasteOut = ''; code = this.discord.escapeCodeBlock(code); const prefix = `\`\`\`${language}\n`; const suffix = '\n```'; - language = language ?? 'txt'; if (code.length + (prefix + suffix).length >= length) { const haste = await this.haste(code, substr); hasteOut = `Too large to display. ${ @@ -322,7 +321,7 @@ export class BushClientUtil extends ClientUtil { */ public async inspectCleanRedactCodeblock( input: any, - language?: CodeBlockLang, + language?: CodeBlockLang | '', inspectOptions?: BushInspectOptions, length = 1024 ) { @@ -653,6 +652,14 @@ export class BushClientUtil extends ClientUtil { return missing.length ? missing : null; } + public prefix(message: BushMessage | BushSlashMessage): string { + return message.util.isSlash + ? '/' + : client.config.isDevelopment + ? 'dev ' + : message.util.parsed?.prefix ?? client.config.prefix; + } + public get arg() { return Arg; } diff --git a/src/lib/utils/BushConstants.ts b/src/lib/utils/BushConstants.ts index 0e1388e..3b41c4f 100644 --- a/src/lib/utils/BushConstants.ts +++ b/src/lib/utils/BushConstants.ts @@ -301,9 +301,9 @@ export class BushConstants { SUPERUSER: '<:superUser:848947986326224926>', DEVELOPER: '<:developer:848954538111139871>', BUSH_VERIFIED: '<:verfied:853360152090771497>', - BOOST_1: '<:boostitle:853363736679940127>', - BOOST_2: '<:boostitle:853363752728789075>', - BOOST_3: '<:boostitle:853363769132056627>', + BOOST_TIER_1: '<:boostitle:853363736679940127>', + BOOST_TIER_2: '<:boostitle:853363752728789075>', + BOOST_TIER_3: '<:boostitle:853363769132056627>', TEXT: '<:text:853375537791893524>', NEWS: '<:announcements:853375553531674644>', VOICE: '<:voice:853375566735212584>', |