Riddle commands in the Chat


#1

Hello Community Mods!

I was wondering if there was a way to setup a command that could provide various riddles for that chat to try and figure out? I have the !8ball command setup and I like the way it is randomized such as a REAL 8ball would be. Did not know if there was a way to build one that could randomly provide brain teasers to add a next level engagement to the chat. Thank you for your time!


#2

In order to make this one would need to find an api that hosts riddles, it would also be a challenge to provide an answer without it in the first question.


#3

First, thank you for responding, you never really know when reaching out on a forum you will get a response from the community. Second (not tech savvy , still learning) what is an API? Third and finally would you then need two programs that would one to provide the question, and one to provide the answer?


#4

An API allows us a way to get information from a service, in this case riddles. When using a Nightbot command it’ll call this API and get data to return to chat. It’s hard to find a public source for useful information, especially doesn’t a correct format for Nightbot.


#5

Oh, that makes perfect sense. Thank you for explaining! Is there a way I could add random fortune cookie phrases as a command?


#6

Hello. I made an API that will fetch a random riddle from http://www.riddles.nu/random and keep track of its answer.

Enter these two lines into your chat:

!addcom !riddle $(urlfetch https://nightbot-clip-command.herokuapp.com/riddle)
!addcom !riddleanswer -ul=moderator $(urlfetch https://nightbot-clip-command.herokuapp.com/riddle?q=answer)

Remove -ul=moderator from the second line if you wish to allow any chatter (not just mods) to display the previous riddle’s answer.


#7

You should be able to copy your !8ball command. Just replace the 8-ball messages with your phrases.

If you have too many phrases to fit within the 500-character limit, then follow these instructions:

Separate your phrases by | and upload them to https://pastebin.com like this: https://pastebin.com/raw/xmtKRpTu

Then enter this into your chat (replace my raw Pastebin link with yours):

!addcom !fortunecookie $(eval phrases = decodeURIComponent("$(querystring $(urlfetch json https://pastebin.com/raw/xmtKRpTu))").split("|"); phrases[Math.floor(Math.random() * phrases.length)])

#8

First and foremost thank you so much for these custom commands! You have made my whole week! Secondly is there a way you could show me an example of how to type out like three options for the fortune cookie responses? I appreciate you and thank you for your time!


#9

Yes, just look at my example: https://pastebin.com/raw/xmtKRpTu


#10

I should be more specific how do i add that into the commands script?


#11

Separate your phrases by | and upload them to https://pastebin.com like this: https://pastebin.com/raw/xmtKRpTu

Then enter this into your chat (replace my raw Pastebin link with yours):

!addcom !fortunecookie $(eval phrases = decodeURIComponent("$(querystring $(urlfetch json https://pastebin.com/raw/xmtKRpTu))").split("|"); phrases[Math.floor(Math.random() * phrases.length)])

#12

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