diff options
author | IRONM00N <64110067+IRONM00N@users.noreply.github.com> | 2021-06-19 16:43:37 -0400 |
---|---|---|
committer | IRONM00N <64110067+IRONM00N@users.noreply.github.com> | 2021-06-19 16:43:37 -0400 |
commit | ea64ebfff9aae32deb036643422d3427959dcd24 (patch) | |
tree | 5ab83558642bad282515837424637070f547a05e /src/lib/utils/Logger.ts | |
parent | d055e0dbb86ef7fd4ee96a1531b51181e825fb4b (diff) | |
download | tanzanite-ea64ebfff9aae32deb036643422d3427959dcd24.tar.gz tanzanite-ea64ebfff9aae32deb036643422d3427959dcd24.tar.bz2 tanzanite-ea64ebfff9aae32deb036643422d3427959dcd24.zip |
feat(*): A bunch of stuff
- Remade logging
- updated dependencies
- started adding custom crap to the command handler
- added emojis to stuff
- can't remeber other stuff
Note: this is currently broken
BREAKING CHANGE:
Diffstat (limited to 'src/lib/utils/Logger.ts')
-rw-r--r-- | src/lib/utils/Logger.ts | 43 |
1 files changed, 0 insertions, 43 deletions
diff --git a/src/lib/utils/Logger.ts b/src/lib/utils/Logger.ts deleted file mode 100644 index 0675e3d..0000000 --- a/src/lib/utils/Logger.ts +++ /dev/null @@ -1,43 +0,0 @@ -import chalk from 'chalk'; -import { TextChannel } from 'discord.js'; -import { BushClient } from '../extensions/BushClient'; - -export class BushLogger { - private client: BushClient; - public constructor(client: BushClient) { - this.client = client; - } - private stripColor(text: string): string { - return text.replace( - // eslint-disable-next-line no-control-regex - /[\u001b\u009b][[()#;?]*(?:[0-9]{1,4}(?:;[0-9]{0,4})*)?[0-9A-ORZcf-nqry=><]/g, - '' - ); - } - public getChannel(channel: 'log' | 'error' | 'dm'): 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); - if (sendChannel) { - const channel = await this.getChannel('log'); - await channel.send('[LOG] ' + this.stripColor(message)); - } - } - - public async verbose(message: string, sendChannel = false): Promise<void> { - if (!this.client.config.logging.verbose) return; - console.log(chalk`{bgMagenta VERBOSE} ` + message); - if (sendChannel) { - const channel = await this.getChannel('log'); - await channel.send('[VERBOSE] ' + this.stripColor(message)); - } - } - public async error(message: string, sendChannel = false): Promise<void> { - console.log(chalk`{bgRed ERROR} ` + message); - if (sendChannel) { - const channel = await this.getChannel('error'); - await channel.send('[ERROR] ' + this.stripColor(message)); - } - } -} |