diff options
author | TymanWasTaken <32660892+tymanwastaken@users.noreply.github.com> | 2021-05-28 21:54:50 -0600 |
---|---|---|
committer | TymanWasTaken <32660892+tymanwastaken@users.noreply.github.com> | 2021-05-28 21:54:50 -0600 |
commit | 2456dab3db0d8eaae515606b83a6c0c317d009b0 (patch) | |
tree | c20448112d43c1b4ffae1395584d9b202aeee3ed /src/lib/utils | |
parent | 1e9e334097702c68d871365fc016aa096d03c491 (diff) | |
parent | 5b5f0bf5667b922037508dfa88e40a1f8a2671ec (diff) | |
download | tanzanite-2456dab3db0d8eaae515606b83a6c0c317d009b0.tar.gz tanzanite-2456dab3db0d8eaae515606b83a6c0c317d009b0.tar.bz2 tanzanite-2456dab3db0d8eaae515606b83a6c0c317d009b0.zip |
fix conflicts
Diffstat (limited to 'src/lib/utils')
-rw-r--r-- | src/lib/utils/AllowedMentions.ts | 6 | ||||
-rw-r--r-- | src/lib/utils/Console.ts | 93 | ||||
-rw-r--r-- | src/lib/utils/Logger.ts | 12 |
3 files changed, 99 insertions, 12 deletions
diff --git a/src/lib/utils/AllowedMentions.ts b/src/lib/utils/AllowedMentions.ts index 47e440b..68c44d7 100644 --- a/src/lib/utils/AllowedMentions.ts +++ b/src/lib/utils/AllowedMentions.ts @@ -34,11 +34,7 @@ export default class AllowedMentions { } public toObject(): MessageMentionOptions { return { - parse: [ - ...(this.users ? ['users'] : []), - ...(this.roles ? ['roles'] : []), - ...(this.everyone ? ['everyone'] : []) - ] as MessageMentionTypes[] + parse: [...(this.users ? ['users'] : []), ...(this.roles ? ['roles'] : []), ...(this.everyone ? ['everyone'] : [])] as MessageMentionTypes[] }; } } diff --git a/src/lib/utils/Console.ts b/src/lib/utils/Console.ts new file mode 100644 index 0000000..b74ea07 --- /dev/null +++ b/src/lib/utils/Console.ts @@ -0,0 +1,93 @@ +// import chalk from 'chalk'; +// import { BushClient } from '../extensions/BushClient'; + +// export class CustomConsole { +// private client: BushClient; +// public constructor(client: BushClient) { +// this.client = client; +// } + +// private parseColors(content: any, color: 'blueBright' | 'blackBright' | 'redBright' | 'yellowBright' | 'greenBright'): string | any { +// if (typeof content === 'string') { +// const newContent: Array<string> = content.split(/<<|>>/); +// const tempParsedArray: Array<string> = []; +// newContent.forEach((value, index) => { +// if (index % 2 !== 0) { +// tempParsedArray.push(chalk[color](value)); +// } else { +// tempParsedArray.push(value); +// } +// }); +// return tempParsedArray.join(''); +// } else { +// return content; +// } +// } + +// private timeStamp(): string { +// const now = new Date(); +// const hours = now.getHours(); +// const minute = now.getMinutes(); +// let hour = hours; +// let amOrPm: 'AM' | 'PM' = 'AM'; +// if (hour > 12) { +// amOrPm = 'PM'; +// hour = hour - 12; +// } + +// return `${hour >= 10 ? hour : `0${hour}`}:${minute >= 10 ? minute : `0${minute}`} ${amOrPm}`; +// } + +// /** +// * Logs debug information. +// * @param content - The content to log. +// */ +// public debug(content: any): void { +// console.log(`${chalk.bgGrey(this.timeStamp())} ${chalk.grey('[Debug]')}`, content); +// } + +// /** +// * Logs verbose information. Highlight information by surrounding it in `<<>>`. +// * @param header - The header displayed before the content, displayed in grey. +// * @param content - The content to log, highlights displayed in bright black. +// */ +// public verbose(header: string, content: string): void { +// return console.info(`${chalk.bgGrey(this.timeStamp())} ${chalk.grey(`[${header}]`)} ` + this.parseColors(content, 'blackBright')); +// } + +// /** +// * 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. +// */ +// public info(header: string, content: string): void { +// return console.info(`${chalk.bgCyan(this.timeStamp())} ${chalk.cyan(`[${header}]`)} ` + this.parseColors(content, 'blueBright')); +// } + +// /** +// * Logs warnings. Highlight information by surrounding it in `<<>>`. +// * @param header - The header displayed before the content, displayed in yellow. +// * @param content - The content to log, highlights displayed in bright yellow. +// */ +// public warn(header: string, content: string): void { +// return console.warn(`${chalk.bgYellow(this.timeStamp())} ${chalk.yellow(`[${header}]`)} ` + this.parseColors(content, 'yellowBright')); +// } + +// /** +// * Logs errors. Highlight information by surrounding it in `<<>>`. +// * @param header - The header displayed before the content, displayed in bright red. +// * @param content - The content to log, highlights displayed in bright red. +// */ +// public error(header: string, content: string): void { +// return console.error(`${chalk.bgRedBright(this.timeStamp())} ${chalk.redBright(`[${header}]`)} ` + this.parseColors(content, 'redBright')); +// } + +// /** +// * Logs successes. Highlight information by surrounding it in `<<>>`. +// * @param header - The header displayed before the content, displayed in green. +// * @param content - The content to log, highlights displayed in bright green. +// */ +// public success(header: string, content: string): void { +// return console.log(`${chalk.bgGreen(this.timeStamp())} ${chalk.greenBright(`[${header}]`)} ` + this.parseColors(content, 'greenBright')); +// } +// } diff --git a/src/lib/utils/Logger.ts b/src/lib/utils/Logger.ts index f38365e..96837b6 100644 --- a/src/lib/utils/Logger.ts +++ b/src/lib/utils/Logger.ts @@ -1,10 +1,10 @@ import { TextChannel } from 'discord.js'; -import { BotClient } from '../extensions/BotClient'; +import { BushClient } from '../extensions/BushClient'; import chalk from 'chalk'; export class Logger { - private client: BotClient; - public constructor(client: BotClient) { + private client: BushClient; + public constructor(client: BushClient) { this.client = client; } private stripColor(text: string): string { @@ -15,9 +15,7 @@ export class Logger { ); } public getChannel(channel: 'log' | 'error' | 'dm'): Promise<TextChannel> { - return this.client.channels.fetch( - this.client.config.channels[channel] - ) as Promise<TextChannel>; + return this.client.channels.fetch(this.client.config.channels[channel]) as Promise<TextChannel>; } public async log(message: string, sendChannel = false): Promise<void> { console.log(chalk`{bgCyan LOG} ` + message); @@ -28,7 +26,7 @@ export class Logger { } public async verbose(message: string, sendChannel = false): Promise<void> { - if (!this.client.config.verbose) return; + if (!this.client.config.logging.verbose) return; console.log(chalk`{bgMagenta VERBOSE} ` + message); if (sendChannel) { const channel = await this.getChannel('log'); |