From a92722bdf6cb21670cafd08f7b964c656cdbc861 Mon Sep 17 00:00:00 2001 From: Oliver Akins Date: Sat, 20 Aug 2022 14:28:52 -0600 Subject: [PATCH] Add a format property that can be returned to not format the message --- src/endpoints/nightbot/advanced.ts | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/endpoints/nightbot/advanced.ts b/src/endpoints/nightbot/advanced.ts index 464ea9c..c219389 100644 --- a/src/endpoints/nightbot/advanced.ts +++ b/src/endpoints/nightbot/advanced.ts @@ -59,6 +59,7 @@ const subcommands: {[index: string]: any} = { if (!message?.includes(`$(count)`)) { return { message: `Can't create a counter when the message doesn't have $(count) in it somewhere`, + format: false, }; }; @@ -150,7 +151,7 @@ const route: ServerRoute = { }; try { - var { message, value } = await sc.handler( + var { message, value=0, format=true } = await sc.handler( request, { channel, user }, args @@ -160,6 +161,9 @@ const route: ServerRoute = { }; if (message) { + if (!format) { + return message; + }; return message.replace(/\$\(count\)/g, value); } else if (value) { return value;