nightbot counter command

Asked Jun 2, 2022·2 replies·Last activity 4 years ago·Open in Discord ↗
Archived from the original community forum
Things may have changed since it was written. Still stuck? Ask the community on Discord.

using this post i was able to set up a death counter

/t/nightbot-command-for-only-removing-1-on-counter-not-reset/1534637453850181884

however the !counter command gives me this response "There have been 1,plus deaths" im very much a noob with all this and cant work out in the code where the text "plus" is coming from.

this was the code ive used my tokens in mine thats all ive altered. any help is apricated.

$(eval a=$(urlfetch https://twitch.center/customapi/quote/list?token=Public_Token&no_id=1);a!=There are no quotes added?There is ${a.split( )[0]}${a.split( )[1]} deaths:There is 0 deaths)

2 replies

Hey @Tangy Lobster!

The "plus" comes from the !add and !substract commands, however I don't understand what is your request: you don't say what you're waiting for.
Also, I don't have much time to update @Quirky Fox's code lately, so I'll let him deal with it once you've replied with more details.
I'm not sure why the "plus" is in the code, I guess it must be important, so if you want to remove it, then the solution is to treat the lack of "plus" as if it was there, which is how I would have written the code in the first place.

On another note, I'm not sure why you'd want to be able to substract to a death counter, so here's another topic that might fit what you're looking for a little bit better:
/t/having-trouble-setting-up-death-counter/1534601379858088127#m1534601381837…

X29rmiibH9.png

Sorry about that those are fairly old commands (and if I’m being honest quite a mess). These ones should do the trick and be much easier to add for future users.

!add

$(urlfetch $(eval B=`https://twitch.center/customapi/`;Q=`quote?token=PRIVATE_TOKEN&data=`;S=`&silent=1`;X=parseInt(decodeURIComponent(`$(querystring)`));N=`$(urlfetch https://twitch.center/customapi/quote/list?token=PUBLIC_TOKEN&no_id=1)`;!isNaN(X)?I=X:I=1;!isNaN(N)?`${B}edit${Q}1%20${parseInt(N)+I+S}`:`${B}add${Q+I+S}`))

!subtract

$(urlfetch $(eval B=`https://twitch.center/customapi/`;Q=`quote?token=PRIVATE_TOKEN&data=`;S=`&silent=1`;X=parseInt(decodeURIComponent(`$(querystring)`));N=`$(urlfetch https://twitch.center/customapi/quote/list?token=PUBLIC_TOKEN&no_id=1)`;!isNaN(X)?I=X:I=1;!isNaN(N)?`${B}edit${Q}1%20${parseInt(N)-I+S}`:`${B}add${Q}-${I+S}`))

!counter

\*Insert Start of Message Here\* $(urlfetch https://twitch.center/customapi/quote/list?token=PUBLIC_TOKEN&no_id=1) \*Insert End of Message Here\*