Random Sentence printed out with nightbot?


#1

Is there a way to pic a random sentence that the nightbot says like every 5 minutes?


#2

First go to https://pastebin.com and upload your sentences. Look at my example (https://pastebin.com/raw/bbGr2ETq) to see how to format your sentences. Use " to surround each sentence, and use , to separate each sentence. Copy the following text, replace my Pastebin link with the one you just created (use the raw link), and then enter it into your chat:

!commands add !randomsentence $(eval sentencesString=decodeURIComponent("$(querystring [$(urlfetch json https://pastebin.com/raw/bbGr2ETq)])");try{sentences=JSON.parse(sentencesString);sentences.length?sentences[Math.floor(Math.random()*sentences.length)]:`No sentences: ${sentencesString}`.substr(0,400)}catch(e){`Failed to parse sentences: ${e}: ${sentencesString}`.substr(0,400)})

Now go to https://beta.nightbot.tv/timers and sign in. Then click “Add” in the top right. Fill the fields with this information:
Name: Random Sentence
Message: !randomsentence
Interval: every 5 minutes
Chat Lines: 2 lines
Alias: !randomsentence

Then click submit.

Now Nightbot will send a random sentence every 5 minutes as long as 2 chat lines have been sent in the last 5 minutes.


#3

Thank you very much!!!


#4

But I cant type all this Code in the Chat! i use yt. and the Maximum Chat length is 200 letters. Is there an other way to do this?


#5

Yes, just add the command here:
https://beta.nightbot.tv/commands/custom


#6

thats also not working it is also too Long! what can i do?


#7

It’s not too long. The command is only 353 characters. The maximum is 500.

$(eval sentencesString=decodeURIComponent("$(querystring [$(urlfetch json https://pastebin.com/raw/bbGr2ETq)])");try{sentences=JSON.parse(sentencesString);sentences.length?sentences[Math.floor(Math.random()*sentences.length)]:`No sentences: ${sentencesString}`.substr(0,400)}catch(e){`Failed to parse sentences: ${e}: ${sentencesString}`.substr(0,400)})

#8

But when i try to paste it, it stops in the middle of the command! let me try again! it has to be in the field message, right?


#9

Yes, you enter the command in the Message field.


#10

It stops at Math.random


#11

Then something is wrong with your browser. Try a different browser.


#12

Ist not working!! I tried every Browser


#13

Try on another computer.


#14

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