Command that searches a bank of quotes, like the djkhaled one

Hi, I’m wondering is there a way to create a command that will randomly choose a quote from a bank of ones I’ve selected. I wanted to do this for shakespeare, Socrates and Confuscius, but I don’t know how to do this, or if it’s possible.

I.E. Someone types shakespeare and nightbot randomly chooses a shakespeare quote from a set I have approved.

Sorry if this seems like a noob question, I’m not expecting someone to write it for me, just wondering if you could point me in the right direction at least.

You can upload your list of quotes to Pastebin, like this example:

Notice how every quote begins and ends with a " and how quotes are separated by ,

Then create a command called shakespeare by typing the message below into your chat. Replace my Pastebin link with the one you just created (use the raw link).

!addcom shakespeare $(eval s=decodeURIComponent("$(querystring [$(urlfetch json])");try{q=JSON.parse(s);(q.length?q[Math.floor(Math.random()*q.length)]:`No quotes: ${s}`).substr(0,400)}catch(e){`Failed to parse quotes: ${e.message}: ${s}`.substr(0,400)})
1 Like

Holy damn, thanks so much!

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