diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/lib/utils/BushLogger.ts | 30 | ||||
-rw-r--r-- | src/listeners/client/akairoDebug.ts | 15 |
2 files changed, 26 insertions, 19 deletions
diff --git a/src/lib/utils/BushLogger.ts b/src/lib/utils/BushLogger.ts index 43c9203..e05f5d6 100644 --- a/src/lib/utils/BushLogger.ts +++ b/src/lib/utils/BushLogger.ts @@ -1,4 +1,3 @@ -import * as assert from 'assert'; import chalk from 'chalk'; // eslint-disable-next-line @typescript-eslint/no-unused-vars import { MessageEmbed, Util, type Message, type PartialTextBasedChannelFields } from 'discord.js'; @@ -162,7 +161,7 @@ export class BushLogger { /** * Logs very verbose information. Highlight information by surrounding it in `<<>>`. - * @param header The header printed before the content, displayed in grey. + * @param header The header printed before the content, displayed in purple. * @param content The content to log, highlights displayed in bright black. * @param depth The depth the content will inspected. Defaults to `0`. */ @@ -178,6 +177,16 @@ export class BushLogger { } /** + * Logs raw very verbose information. + * @param header The header printed before the content, displayed in purple. + * @param content The content to log. + */ + public static async superVerboseRaw(header: string, ...content: any[]): Promise<void> { + if (!client.config.logging.verbose) return; + console.info(`${chalk.bgHex('#8423b8')(this.#getTimeStamp())} ${chalk.hex('#8423b8')(`[${header}]`)}`, ...content); + } + + /** * Logs information. Highlight information by surrounding it in `<<>>`. * @param header The header displayed before the content, displayed in cyan. * @param content The content to log, highlights displayed in bright blue. @@ -268,23 +277,6 @@ export class BushLogger { .setTimestamp(); await this.channelLog({ embeds: [embed] }).catch(() => {}); } - - /** - * Asserts a condition. If the condition is false, an error is thrown. - * @param type The type of assertion. - * @param actual The value to test. - * @param expected The expected value. - * @param message The error to throw if the assertion fails. - */ - public static assert<T>(type: AssertTypeEqual, actual: unknown, expected: T, message: Error): asserts actual is T; - public static assert<T>(type: AssertTypeNotEqual, actual: unknown, expected: T, message: Error): void; - public static assert(type: AssertType, actual: unknown, expected: unknown, message: Error): void { - assert[type](actual, expected, message); - } } -export type AssertTypeEqual = 'deepEqual' | 'deepStrictEqual' | 'equal' | 'strictEqual'; -export type AssertTypeNotEqual = 'notDeepEqual' | 'notDeepStrictEqual' | 'notEqual' | 'notStrictEqual'; -export type AssertType = AssertTypeEqual | AssertTypeNotEqual; - /** @typedef {PartialTextBasedChannelFields} vscodeDontDeleteMyImportTy */ diff --git a/src/listeners/client/akairoDebug.ts b/src/listeners/client/akairoDebug.ts new file mode 100644 index 0000000..af66677 --- /dev/null +++ b/src/listeners/client/akairoDebug.ts @@ -0,0 +1,15 @@ +import { BushListener, type BushClientEvents } from '#lib'; + +export default class DiscordJsDebugListener extends BushListener { + public constructor() { + super('akairoDebug', { + emitter: 'client', + event: 'akairoDebug', + category: 'client' + }); + } + + public override async exec(...[message, ...other]: BushClientEvents['debug']): Promise<void> { + void client.console.superVerboseRaw('akairoDebug', message, ...other); + } +} |