Add a format property that can be returned to not format the message
This commit is contained in:
parent
3f5a122bae
commit
a92722bdf6
1 changed files with 5 additions and 1 deletions
|
|
@ -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;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue