Disabling Nightbot caching

Hey I have a small php script on my own server which returns a random string based on luck. Right now I am having issues with people posting the command quickly and getting the same response.I can run the php directly without delay.

I read through the topics here and found that a dev said that nightbot cached responses from custom apis and had different delays for each time of user (regular/mod/owner)

Is there some way I can disable this ? I know I will have to do my own anti spam and stop people from crashing my server. I dont mind that, I can do the code on the php side.

I just want people to be able to repeat the command and not get cached responses, any way around this and I would be happy.

Thanks for an awesome bot =D

Nightbot caches the server response for only 10 seconds, so it most likely is not a caching issue that you’re mentioning. Nightbot enforces a cool-down of 30 seconds for non-moderators to lessen the amount of spam it might post in chat. This will be customizable in the next version of Nightbot, but I do not have a solid ETA on when it might be available.

An example just to understand better.

customapi command like say “PickCake” and it will either return “Chocolate” or “Strawberry”.

Two users type PickCake with 1 second interval

both users will always get the same answer from the server response.

Isnt there any way around this ?

As long as you are appending the username to the request to your server, this shouldn’t be an issue.

The nightbot command is as follows: "[user] [customapi]"
The custom api is a php file rougly as follows:

$str1 =GetResultOfRandom($num1);
$str2 =GetResultOfRandom($num2);
$str3 =GetResultOfRandom($num3);

      echo "|  ". $str1 . "   |   " . $str2 . "   |   " . $str3 . "  |";   

if($str1 == $str2 && $str1 == $str3)
  echo "WINNER! ";
else if($str1 == "Slots1" && $str2 == "Slots2" && $str3 =="Slots3" )
  echo "Special WINNER! ";
  echo " Try Again Next Time";

cant I use echo for this ?

You want to pass the username into your customapi

$(customapi http://url/to/grab?user=$(user))


Is there anyway you could manually alter the cool-down time of a channel without me having to wait for a new version?
It is a shame to see my normal users not being able to use it more often.

Any way it work with the user being a part of the custom and a GET added to the code. Thanks again! nice with quick response time =D

Also is the cool down a generel cool down or a per user cool down ?

It seems we have a lot of non mod users using the command without a return and I am unsure if it is because only one non mod can use it per 30 sec. Any way around this ?

The cooldown is 30 seconds per command, and it isn’t modifiable, sorry. You will unfortunately need to wait for the next Nightbot version.

Okay, thanks for the help with caching. Will await the next version for the cooldwon. Customer support rating 10/10 <3