Setting up a list

I am completely new to Nightbot and have little to no idea about how to set up custom commands. What I specifically want to know how to do it how when someone comes in and wants to submit a course (I stream mostly Mario Maker btw) that nightbot can pick that up and put them in a line and when I need to see that line, or if others want to see it, I can type something else in and see the line or others can do so as well.

Because these commands contain private tokens, you should add them through the Nightbot web interface:

Go to You will see three lines. Your first token is after token= and before &data= on the first line. Your second token is after token= and before &data= on the second and third lines. Replace FIRSTTOKEN and SECONDTOKEN with these before you add the following commands.

$(eval q=`$(urlfetch json`;u=`$(user)`.split(" ")[0];c=`$(query)`.split(" ")[0];e=false;r=/([^ ]*): [^ ]* /g;while((m=r.exec(q))!==null){if(u.toLowerCase()==m[1].toLowerCase()){e=true}}if(e){"$EXISTS$"}else if(!c){"$NOCOURSE$"}else{"addquote?token=SECONDTOKEN&data="+encodeURIComponent(`${u}: ${c} `)})

$(eval if(`$(urlfetch json$(query))`.startsWith("Successfully added entry ")){`@$(user) your course was submitted!`}else if(`$(query)`=="$EXISTS$"){`@$(user) you have already submitted a course!`}else if(`$(query)`=="$NOCOURSE$"){`@$(user) enter the course link after !submitcourse`}else{`@$(user) use !submitcourse`})

$(eval q=`$(urlfetch json`;n3="";i=0;r=/([^ ]*): ([^ ]*) /g;while((m=r.exec(q))!==null&&i<3){n3+=`${m[1]}: ${m[2]} `;i++}i==0?"There are no courses in the queue":`Next ${i==1?"course":i+" courses"}: ${n3}`)

Full course queue:

!popqueue (userlevel moderator)
$(eval r=`$(urlfetch json`;m=r.match(/^Successfully deleted entry #1: (.*)$/);if(m){m[1]}else if(r=="Invalid entry index"){"The course queue is empty"}else{`Unknown error (${r})`})

!clearqueue (userlevel moderator)
$(eval q=`$(urlfetch json`;r=`$(urlfetch json`;if(q=="There are no quotes added"){"The course queue is already empty"}else if(r=="All entries have been deleted"){"The course queue has been cleared"}else{`Unknown error (${r})`})

Command explanations:

Only one course may be submitted per user. If there is a space in whatever the user typed, anything after it is ignored. This is because I assume the users are supposed to submit links. Other than that, there is no validation of whether what the user typed is actually a course, since I don’t know what website you’re using. I can add that if you give an example of a course link.

Utility command for !submitcourse. Don’t use manually.

View the next 3 courses in the queue.

Link to a website containing the entire course queue.

Nightbot will print the first course in the queue and remove it from the queue.

Remove everything from the course queue.

If the commands don’t work at all, you didn’t properly insert your tokens.

1 Like

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