diff options
| author | Max Isom <[email protected]> | 2020-03-17 17:59:26 -0500 |
|---|---|---|
| committer | Max Isom <[email protected]> | 2020-03-17 17:59:26 -0500 |
| commit | 15d4e251f2af47288b4d5720b8a7b763e72731c0 (patch) | |
| tree | 4a21df4ff46747cad0c491ea67c9127b303c3113 /src/utils | |
| parent | 1a1bdfd674970c87f6de941dcd51b0aff16156ce (diff) | |
| download | muse-15d4e251f2af47288b4d5720b8a7b763e72731c0.tar.xz muse-15d4e251f2af47288b4d5720b8a7b763e72731c0.zip | |
Add better responses
Diffstat (limited to 'src/utils')
| -rw-r--r-- | src/utils/debug.ts | 3 | ||||
| -rw-r--r-- | src/utils/error-msg.ts | 13 | ||||
| -rw-r--r-- | src/utils/loading-message.ts | 4 |
3 files changed, 18 insertions, 2 deletions
diff --git a/src/utils/debug.ts b/src/utils/debug.ts new file mode 100644 index 0000000..ee33384 --- /dev/null +++ b/src/utils/debug.ts @@ -0,0 +1,3 @@ +import debug from 'debug'; + +export default debug('muse'); diff --git a/src/utils/error-msg.ts b/src/utils/error-msg.ts new file mode 100644 index 0000000..7325776 --- /dev/null +++ b/src/utils/error-msg.ts @@ -0,0 +1,13 @@ +export default (error?: string | Error): string => { + let str = '🚫 unknown error'; + + if (error) { + if (typeof error === 'string') { + str = `🚫 ${error}`; + } else if (error instanceof Error) { + str = `🚫 error: ${error.name}`; + } + } + + return str; +}; diff --git a/src/utils/loading-message.ts b/src/utils/loading-message.ts index 3d24905..cf48d95 100644 --- a/src/utils/loading-message.ts +++ b/src/utils/loading-message.ts @@ -7,7 +7,7 @@ export default class { private msg!: Message; private isStopped = false; - constructor(channel: TextChannel, text: string) { + constructor(channel: TextChannel, text = 'cows! count \'em') { this.channel = channel; this.text = text; } @@ -53,7 +53,7 @@ export default class { })(); } - async stop(str?: string): Promise<Message> { + async stop(str = 'u betcha'): Promise<Message> { this.isStopped = true; if (str) { |
