Riddle commands in the Chat

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!

1 Like

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.

1 Like

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?

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.

1 Like

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

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.

3 Likes

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)])
2 Likes

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!

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

Here our the four phrase I would like. I have tried several times to make a link and it keeps breaking in my chat. Will you please make a working link for me? Thank you for your time.

Drinking GFuel will bring you great joy and energy
Your hidden talents will come in handy when playing hide and seek
Dream become reality the moement you open your eyes
No matter how hard life gets there is always something to be thankful for

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)])
1 Like

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