How to create a Q&A Command?

Unsure if this has been covered previously, and if it has please send a link so I can read up on it.

Anyways, here is my question:

I am trying to create a simple nightbot command for Q&A which takes the users question, saves it in a queue list that I specify, and then spits a response to the user indicating that their question has been recorded.

Not entirely sure how to do this, but I have seen other peoples twitch channels do this and found it very interesting and engaging. I am developing my twitch stream currently and this is a feature I would love to have on my channel.

@roostercogburne

Ehsankia’s quote list API can be used to set up a list of questions that users can add to.


Click this link. It will generate three links and two tokens, a public token (8 characters long) and a private token (16 characters long). The public token is located within the first generated link. The private token is located within both the second and third generated links. The tokens are found after token= and before &data=$(querystring) Copy them and keep them somewhere safe!

I set up 3 commands below: !qna which adds a user’s question to the list, !qnasearch which lets you look up individual questions from the list, and !qnaclear (mod-only) which clears the list. Either copy and paste these commands into chat or add them through the Nightbot dashboard. Add the commands through chat only if you are sure no one else is there, otherwise they might see your private token (which is used to manage the list)! Replace PUBLIC_TOKEN with your public token and PRIVATE_TOKEN with your private token.

!addcom -cd=5 !qna $(eval `$(urlfetch http://twitch.center/customapi/addquote?token=PRIVATE_TOKEN&data=$(user): $(querystring))`.includes(`Successfully added entry`)?`@$(user) Your question has been recorded!`:`@$(user) Try again.`)

!addcom -cd=5 !qnasearch Question from $(urlfetch http://twitch.center/customapi/quote/list?token=PUBLIC_TOKEN&data=$(querystring)&no_id=1)

!addcom -ul=mod !qnaclear $(eval `$(urlfetch http://twitch.center/customapi/delquote?token=PRIVATE_TOKEN&clear=1)`==`All entries have been deleted`?`$(user) has cleared the Q&A list!`:`@$(user) Try again.`)

Usages:

!qna [your question]

!qnasearch [question list ID or you can leave this blank to get a random question, 1 is the oldest recorded question]

!qnaclear

@RokettoJanpu

THANKS! This is a HUGE help. Really appreciate it!

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