added help cmd, and helper function to misc

This commit is contained in:
murm 2023-03-18 20:00:37 -04:00
parent a530b4ae8e
commit 102c3f097b
2 changed files with 37 additions and 4 deletions

View file

@ -20,6 +20,8 @@ const optionalReplace = (token) => {
return token === undefined || token === "" ? "" : (token === "true" || token === "false" ? token : "<redacted>");
};
// clean(text) to clean message of any private info or mentions
export function clean(text) {
if (typeof text !== "string")
@ -63,6 +65,17 @@ export async function activityChanger(bot) {
setTimeout(() => activityChanger(bot), 900000);
}
export function htmlescape (s) {
let lookup = {
'&': "&amp;",
'"': "&quot;",
'\'': "&apos;",
'<': "&lt;",
'>': "&gt;"
};
return s.replace( /[&"'<>]/g, c => lookup[c] );
}
export async function checkBroadcast(bot) {
if (!db) {
return;