Add better responses

This commit is contained in:
Max Isom 2020-03-17 17:59:26 -05:00
parent 1a1bdfd674
commit 15d4e251f2
17 changed files with 103 additions and 63 deletions

3
src/utils/debug.ts Normal file
View file

@ -0,0 +1,3 @@
import debug from 'debug';
export default debug('muse');

13
src/utils/error-msg.ts Normal file
View file

@ -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;
};

View file

@ -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) {