aboutsummaryrefslogtreecommitdiff
path: root/src/utils
diff options
context:
space:
mode:
Diffstat (limited to 'src/utils')
-rw-r--r--src/utils/debug.ts3
-rw-r--r--src/utils/error-msg.ts13
-rw-r--r--src/utils/loading-message.ts4
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) {