Help with Nightbot commands

Asked Mar 19, 2022·3 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.

Hey everyone!
When you put in the random viewer code, what is the code to get a random answer (that you type into nightbot)?
Hopefully this makes sense and you guys can help!
Thank you all in advance,
Leigha

3 replies

You talk about the code to create a own command or one code to create a random answer command in nightbot.tv?

In php the code is:
<?php
$answers = array(
"Answer1",
"Answer2",
"Answer3",
"Answer4"
);
$random =
array rand($answer);
echo $answers[$random];
?>

After doing this, you upload the command to the Internet and make the next command in nightbot

!addcom ![command a name] $(urlfetch [URL of the command you uploaded to the internet])

I don't quite understand what a "the random viewer code" is. Depending on what type of random answers you want we can start to figure out where to start.