Api returns only one result

Hello guys, I have a problem and I do not know what to do. I was trying to have a command that works like so

–> !beer then it will return $(User) + random generated phrase from php file.
Unfortunately it only returns the result of one phrase per (twitch channel) chat. This means that the custom command only checks and remember api result without updating every time the command is used.
$(user) $(customapi http://icelf.net/uploads/test.php?channel=noobinthecage&limit=5)

The php file generates one random phrase and works without issue in browser.
Looks like I have to find a way to make the php file clear cache =/ I have tried so many things

What should I do?

Nightbot outputs what your API returns. Considering I know nothing about how your API works I cannot offer any useful information…

Responses from custom APIs are cached for 10 seconds. Other than that, Nightbot should call the API again.

I am not sure about that, it has been outputting same thing for more than 2 days =/

After testing your API myself, it does not return random responses. Check your code.


// First convert the request URI to a hexadecimal number, via the md5 hash
$num = md5($_SERVER[‘REQUEST_URI’]);

// Next, shorten it so the number isn’t too big, and convert it to decimal
$num = hexdec(substr($num, 27)); // this gives us a number between 0 and 65,535

// Now, convert it to a range between 0 and 5 by taking the modulus
$num = $num % 6;

// Add one…

// And use the same switch statement we used before to achieve our desired result…
switch ($num) {
case 1:
echo “was killed by alcohol poisoning.”;
case 2:
echo “started dancing seriously with a rapy look.”;
case 3:
echo “just wants to die now…”;
case 4:
echo “is off to see a wizard”;
case 5:
echo “started licking the floor.”;
case 6:
echo “WTF MAN???”;

As the request URL never changes for a single channel, the response never changes in that single channel.

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