Monitor time since last command

I’m trying to create a command to monitor how long it has been since a command was last used.

Any help is appreciated. thanks.

You can do this using ehsankia’s quote list CustomAPI - read more about it here.

Click this link. It will generate three links and two tokens, a public token (8 characters long) and a private token (16 characters long). The public token is located within the first generated link. The private token is located within both the second and third generated links. The tokens are found after token= and before &data=$(querystring) Copy them and keep them somewhere safe!

I assume what you want uses two commands: a command that does something and a command that tells how long ago the former command was used. I’m going to call the former command !test and the latter command !testtime

I’ve set up two such commands down below. Either copy and paste these commands as they are into your chat OR use the Nightbot dashboard to create the commands. Feel free to rename the commands as you wish. Replace PUBLIC_TOKEN with your public token and PRIVATE_TOKEN with your private token before adding the commands. Replace [!test command response here] with whatever command response you want.

!addcom -cd=5 !test $(eval a=`$(urlfetch$(time EST "MMM D Y HH:mm:ss z"))`;` `) [!test command response here]

!addcom -cd=5 !testtime The !test command was used $(countup $(urlfetch ago.
 Wow.  Thank you so much this makes things so much simpler than what I was trying to pull off.

It’s actually giving me an invalid timezone error.

Did you in any way change the $(time) variable in the !test command response?

Just to be sure, could you post the responses of both commands? Remember to leave out your tokens, though!

I didn’t change anything in the time I just copied and re used. I changed the token slot and thats it.

!addcom -cd=5 !ontrack $(eval a=$(urlfetch$(time EST "MMM D Y HH:mm:ss z"));)

  1. Are you sure you used the private token (16 characters long) in !ontrack and the public key (8 characters long) in the other?

  2. I’d like to see the responses for BOTH commands just to be sure they should be working. Also, may I have the public key? I just want to see that the information !ontrack is passing to the Custom API is appropriate. You can post it here or privately message me, really only the private key needs to be kept a secret.

I had the keys reversed. Let me fix that and get back to you.

Still got an invalid timezone response

ModeratorSubscriberSub GifterLuminaryEagle: !ontrack
ModeratorVerifiedNightbot: **** has been on track for Invalid timezone specified. For a list of timezones, check

Here is the exact command minus the key

!addcom -cd=5 !sidetracked Wifi has been sidetracked $(count) times so far. $(eval a=$(urlfetch$(time EST "MMM D Y HH:mm:ss z"));)

So there’s 2 things:

  1. I need the public key so I can check whether the info that !sidetracked is passing to the Custom API is as it should be.

  2. The backticks are making the formatting of your post weird (it makes some parts of the text in a different font surrounded by gray) so I’m having a hard time figuring out what’s going wrong. Could you instead post a screenshot of the command response (with the private key covered up) or use the text editor to format the post correctly?

Here is the public key

Then here is a screenshot of the command with the Private key removed


I deleted that one and re added it with the original format one sec i took a screenshot of the wrong one.


Got it working but the command is giving an error connecting to web eval service

ModeratorSubscriberSub GifterLuminaryEagle: !sidetracked
ModeratorVerifiedNightbot: Wifi has been sidetracked 2 times so far. [Error Connecting To WebEval Service]
ModeratorSubscriberSub GifterLuminaryEagle: !ontrack
ModeratorVerifiedNightbot: Wifi has been on track for 5 seconds

In the !sidetracked command, inside the $(eval) variable put " " after the semicolon.

!addcom -cd=5 !sidetracked Wifi has been sidetracked $(count) times so far. $(eval a=’$(urlfetch$(time EST “MMM D Y HH:mm:ss z”))’;" ")

Like this?

!addcom -cd=5 !sidetracked Wifi has been sidetracked $(count) times so far. $(eval a='$(urlfetch$(time EST "MMM D Y HH:mm:ss z"))';" ")

Straight double and single quotes should be used, not the curly quotes

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.