Commands: basic error handling

This commit is contained in:
Vendicated 2022-10-12 22:22:21 +02:00
parent 83d480a68c
commit 267b2b1a07
No known key found for this signature in database
GPG key ID: EC781ADFB93EFFA3
6 changed files with 240 additions and 181 deletions

View file

@ -157,3 +157,11 @@ export function suppressErrors<F extends Function>(name: string, func: F, thisOb
}
}) as any as F;
}
/**
* Wrap the text in ``` with an optional language
*/
export function makeCodeblock(text: string, language?: string) {
const chars = "```";
return `${chars}${language || ""}\n${text}\n${chars}`;
}