diff options
Diffstat (limited to 'src/lib')
-rw-r--r-- | src/lib/common/typings/CodeBlockLang.ts | 3 | ||||
-rw-r--r-- | src/lib/extensions/discord-akairo/BushClientUtil.ts | 11 | ||||
-rw-r--r-- | src/lib/extensions/discord.js/BushGuildMember.ts | 2 |
3 files changed, 9 insertions, 7 deletions
diff --git a/src/lib/common/typings/CodeBlockLang.ts b/src/lib/common/typings/CodeBlockLang.ts index 5a1aeba..d0eb4f3 100644 --- a/src/lib/common/typings/CodeBlockLang.ts +++ b/src/lib/common/typings/CodeBlockLang.ts @@ -307,4 +307,5 @@ export type CodeBlockLang = | 'yml' | 'yaml' | 'zephir' - | 'zep'; + | 'zep' + | 'ansi'; diff --git a/src/lib/extensions/discord-akairo/BushClientUtil.ts b/src/lib/extensions/discord-akairo/BushClientUtil.ts index c5a5b30..5c641b6 100644 --- a/src/lib/extensions/discord-akairo/BushClientUtil.ts +++ b/src/lib/extensions/discord-akairo/BushClientUtil.ts @@ -685,9 +685,9 @@ export class BushClientUtil extends ClientUtil { * @param error */ public async handleError(context: string, error: Error) { - await client.console.error(_.camelCase(context), `An error occurred:\n${util.formatError(error)}`, false); + await client.console.error(_.camelCase(context), `An error occurred:\n${util.formatError(error, true)}`, false); await client.console.channelError({ - embeds: [await CommandErrorListener.generateErrorEmbed({ type: 'unhandledRejection', error: error, context })] + embeds: await CommandErrorListener.generateErrorEmbed({ type: 'unhandledRejection', error: error, context }) }); } @@ -1077,17 +1077,18 @@ export class BushClientUtil extends ClientUtil { /** * Formats an error into a string. * @param error The error to format. + * @param colors Whether to use colors in the output. * @returns The formatted error. */ - public formatError(error: Error | any): string { + public formatError(error: Error | any, colors = false): string { if (!error) return error; if (typeof error !== 'object') return String.prototype.toString.call(error); if ( this.getSymbols(error) .map((s) => s.toString()) - .includes('Symbol(util.inspect.custom)') + .includes('Symbol(nodejs.util.inspect.custom)') ) - return error.inspect(); + return this.inspect(error, { colors }); return error.stack; } diff --git a/src/lib/extensions/discord.js/BushGuildMember.ts b/src/lib/extensions/discord.js/BushGuildMember.ts index 7cc89d2..20a1f60 100644 --- a/src/lib/extensions/discord.js/BushGuildMember.ts +++ b/src/lib/extensions/discord.js/BushGuildMember.ts @@ -373,7 +373,7 @@ export class BushGuildMember extends GuildMember { const muteSuccess = await this.roles .remove(muteRole, `[Unmute] ${moderator.tag} | ${options.reason ?? 'No reason provided.'}`) .catch(async (e) => { - await client.console.warn('muteRoleAddError', util.formatError(e)); + await client.console.warn('muteRoleAddError', util.formatError(e, true)); return false; }); if (!muteSuccess) return unmuteResponse.ACTION_ERROR; |