[CustomAPI] Quote system

Cool thanks again :smiley:

Hello ehsankia,

An inexperienced mod tried to add a quote by editing the !quote command, resulting in the loss of the API call. I’m now trying to fix the command, but have no record of the public token. Is there anyway to retrieve it using the private?

Private message me your private key and I’ll get you your public key.

How can I format my add command in such a way I can specify who said the quote? Here is what I’m looking for:
!addquote Maddyn13 The answer is 42.
When querying that quote with the quote command would return:
“The answer is 42” - Maddyn13, May 1st, 2017

I’ve got the date part figured out from reading this thread, but I can’t figure out how to separate the username from the quote. I always end up with “Maddyn13 The answer is 42.” for the quote. Does anyone know how I can modify the following so that the user isn’t part of the quote?

$(urlfetch http://twitch.center/customapi/addquote?token=XXXXXXXXX&data="$(querystring)" - $(touser), $(time America/New_York “MMMM do, YYYY”))

You can do so with a little eval, but it gets a little hard to follow so just use this command and replace the token where you need:

!addquote:

$(urlfetch http://twitch.center/customapi/addquote?token=[YOUR_TOKEN]&data="$(eval var q = "$(query)"; q.slice(q.indexOf(" ") + 1))" - $(touser), $(time America/New_York "MMMM do, YYYY"))
1 Like

Thank you. That appears to work. I kind of follow what you did but I don’t code/script enough to retain it. I’ll forget it tomorrow. lol

Hello,
i recently installed the commands for my channel (btw i think they are great nice job to the creator). Ichanged some of the code to add some text on the list and so on nothing important. However now i am trying to set a command so all the duplicate entries will be removed. I use the api so wievers request a character i should pick and then i remove it so the command !nextrequest shows me the next character i should pick, i want to see if its possible to creat a command such as !delquote but instead deletes all entries with the same name. If it isnt is it then possible that the command !addquote replies (or not) with “this quote is already in the list” and doesnt list it. I am not very familiared with the language used on nightbot but i have knowlegde in java and c++ if thats any useful. Ill apreciate any help.

How do I use !quote list to display the list without using a URL?

Lists are generally too large to fit in chat and they would be cluttered because twitch chat doesn’t support newlines. So its not recommended to do.

The discord message limit might be much higher, but there still is one, so I don’t think it’d be a good idea either. And anyways, there’s no way for me to tell if the request is coming from Twitch or Discord so I have to always assume I have a 500 character limit. There are many other discord bots, maybe some of them support a better quote feature, but this is mostly made for Twitch use.

I’m a moderator in a stream and I’m having trouble with the delete quote command. The command I have written is

-ul=mod $(urlfetch http://twitch.center/customapi/delquote?token=TOKEN&data=$(querystring))

When I try to delete the quote that we have in the system, nightbot responds with “Invalid Entry Index”. When I do !quote, however, it shows the first quote. Was there something that I was supposed to change? I’m very new to creating commands like this. Thank you

@monabalona – For example if you wanted to add the “Add quote” command, and have only Moderators be able to add quotes, the command would be:

!addcom !addquote -ul=moderator $(urlfetch http://twitch.center/customapi/addquote?token=YOUR_TOKEN_HERE&data=$(querystring))
Remember to replace "YOUR_TOKEN_HERE" with your actual token.

Alternatively you could access Nightbot’s dashboard, navigate to Custom Commands, find your !addquote command if you already have one and just edit it by changing the User Level to whatever you want to set it to.

1 Like

How would I find the actual token?

If you read the original post there is a link to a page that generates your own tokens/URLFetches:
https://twitch.center/customapi/quote/generate
Once you head there, take note of all 3 lines because the next time you open that page or refresh it, the token on those 3 lines will be re-drawn (randomly generated).

1 Like

Thank you so much for your help. When I fixed the part about the userlevel I accidentally got rid of the token. I really appreciate your patience

1 Like

Hey,

I just want to say this API is amazing, works perfectly. Thank-you for creating this and sharing it with us.
Keep up the great work :slight_smile:

I was wondering how I could use this for a song request queue for a rhythm game like Guitar Hero. The original idea I had was if I could have two quote lists: the first with the songs available for request and the second with a queue of songs requested by users. If this is possible, could it also pull the entire quote using its index from the first quote list?

If these are possible, I have more questions to build on this but I just want to make sure I’m on the right track to finding a solution

Why not just have a static list on some other hosted website(Pastebin, Google Docs or Github), then use the quote system for requests.

Hello,

i have a question.

Somehow my command !quote was deleted and the specific URL was lost. Now i added a new !quote command, but it has another URL.

So my recent quotes got lost. Is there any posibility to regain them or the old URL?

Best regards,

Stan

Do your addquote/delquote command get deleted too? If you can PM me your private token I can recover your public token that’s used in !quote. But if you complete reset all 3 commands and replaced your addquote, then you probably lost that too. Depending on how many quotes you had, I can try to manually search for it but it’s a lot of work.