[CustomAPI] Quote system

Hey @diamondemerald360!

From what I can gather, it seems you add quote numbers yourself. It’s not necessary, the API adds them by design, starting at 1.
However, if you wish to keep it this way and not have the 1. in front of your 0, you can update your !quote command like so:

$(urlfetch https://twitch.center/customapi/quote?token=PUBLIC_TOKEN&data=$(querystring)&no_id=1)

Be sure to replace the PUBLIC_TOKEN field by yours.

I have a question. Is there a way to add numbers together, one being a query string and another being the quote?

1 Like

Hey @diamondemerald360!

Yes you can, if the last quote is a number, and if the query is a number as well, you can then add them together with this command:

$(eval a=parseInt(`$(urlfetch https://twitch.center/customapi/quote?token=PUBLIC_TOKEN&data=-1&no_id=1)`); b=parseInt(`$(query)`); c=a+b; isNaN(c)?`Enter a number. / The quote isn't a number.`:`${a} + ${b} = ${c}`)

Hello!
We’ve been using your api a lot and we are really enjoying it. We want to make back-ups of everything, just in case, but the !quote list command no longer works. The url it gives, leads to a google screen with a 403 error. This is only a recent problem, I can remember it working about a month ago.

Is there any way in which we can still access the full list? Is there something in our browser we have to change (I tried firefox and Edge) or is this a bug?

2 Likes

@Emily

Hi,

I was wondering if you would be able to pm me as I have a few questions regarding the quote system.

Thanks.

1 Like

Hi all. Been using this quote system in my twitch channel for almost 4 years now, and we just noticed there’s a cap of 2000 quotes.

Is there a way to expand this number? Our regulars are really fond of the quotes and I would prefer to not delete the old ones.

1 Like

I found a bug… when referencing quote number 0 or -1 and the quote numbering is on it returns the latest quote with the ID of 0 instead of it actual ID number.

Also would it be possible to be able to pass a variable to disable !quote list? Prefer to have that in a separate command.

1 Like

Hello, I’m a moderator in a channel where I’ve set up a pretty basic quote system, works fine, I was just wondering if there is a way to change the !quote command to output “#1 Quote…” instead of “1. Quote…” I’ve read a few things in this thread, tried to put the # before the command but it outputs "#1. Quote… " instead of the actual "#1 Quote… " that I’m looking for, is this possible to do? Messed a bit with the code but I’m not a pro at JS and couldn’t make it work.

1 Like

Ok so I’m having trouble getting the Quote command to return the quote list in the form of a URL link. How would I do that?

1 Like

@gyradosrage

The list URL is https://twitch.center/customapi/quote/list?token=PUBLIC_TOKEN where PUBLIC_TOKEN is your list public token which can be found in the !quote command and is 8 characters long. Just put this URL at the end of your !quote command response.

1 Like

I could use some help. I had added the api to nightbot and it was showing the quotes for both myself as the Broadcaster, but then nightbot would repeat the quote.

after clearing the quotes it still will chat a quote from me as the broadcaster but nightbot says “there are no quotes added”

any help would be greatly appreciated

1 Like

Hi :slightly_smiling_face: I’ve been using this at the suggestion of someone under a thread I posted under this forum. Just wanted to say thank you and it’s working brilliantly. I had a question and was wondering if it’s possible?

Is it possible to stop users from using the command more than once? Mine is set for !request so viewers can make requests but it is being abused slightly with some viewers submitting 10+ requests and was curious if there is a function to limit the use to once per person?

Thank you again :slightly_smiling_face:

1 Like

Hey @chloelunn9!

Yes you can! I assume you’re using Random Requests Command so I’ll go from there and update it to check if they already reached the maximum number of requests before adding or declining theirs.

So instead of simply having:

$(urlfetch https://twitch.center/customapi/addquote?token=PRIVATE_TOKEN&data=$(user) - $(querystring))

It’ll be something like this:
!request:

$(eval d=`$(urlfetch json https://twitch.center/customapi/quote/list?token=PUBLIC_TOKEN)`.replace(/\d+\./g,` -`).split(` - `); t=0; d.forEach(e=>e==`$(user)`?t++:t); t>10?`max`:`PRIVATE_TOKEN&data=$(user) - $(querystring)`;)

And now !request will have an alias:
_request:

$(eval a=`$(urlfetch https://twitch.center/customapi/addquote?token=$(query))`; q=`$(query)`; q==`max`?`You reached the maximum amount of requests, please be patient.`:a;)

Notes:
• Right now the limit is at 10 requests, you can set it higher or lower by adjusting the number in the t>10 test in the first command.
• You can also change the message they get when they reached the maximum amount of requests in the second command.

1 Like

Thank you so much you’ve been so helpful especially since I am so useless with all of this! Appreciate it :slightly_smiling_face:

2 Likes

how can i use this with streamelements? i want to have a separate quote system from the default one which would have a different name, and this API seems perfect for that but i can’t figure out how to add this to streamelements. i tried to just replace each instance of ${querystring} with $(queryencode $(1:|' ')) but that doesn’t work, it says “Parsing error at position 11: Mismatched input list, missing end of inputs” and i am not even close to being able to understand what that means

1 Like

Hey @yanzinator!

Wow, Streamelements documentation is hard to navigate through…
Usually we don’t give support for other bots, so next time please take the time to read the documentation Streamelements provide.

I think you can replace $(querystring) with ${pathescape ${1:}} or ${queryescape ${1:}}
If none of the two work, it’s not possible.

Been searching through the thread, but can’t seem to find anything. Is there a way to add a date to the quote, but just as month/day/year, without the specific time of day?

2 Likes

Hey @C-Dubble!

Yes, use the $(time) variable:

&data=$(querystring)%20[$(time TIMEZONE "MM[/]DD[/]YYYY")]

Make sure to replace TIMEZONE with yours according to the list.


pls help. I got ban because I did a “for(int i = 0; i < 0; i++)” with custom api using unity :<, what can i do? (sorry for my english)

1 Like

This API isn’t made to be used in Unity. It’s for Twitch and chat bots. It’s a database for your game.

1 Like