[CustomAPI] Quote system

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

but can i get unban? i used for twitch and then i tried in unity, i love this custom api :ā€™<

1 Like

first of all thank you for this commands. they are amazing. both chat and streamer are having so much fun.

is there anyway to see all quotes? list or something like that

1 Like

Hey @spectvil!

Yes, use this URL:

http://twitch.center/customapi/quote/list?token=PUBLIC_TOKEN

Replace PUBLIC_TOKEN with the 8 characters long token thatā€™s in your quote command (not addquote, delquote, or editquote).

2 Likes

Okay, so with the option to view that list, is there anyway to do a mass edit on that list page?

1 Like

To my knowledge the edit quote function can only edit one qoute at a time Iā€™m not saying for certain that he hasnā€™t added one but to my knowledge this is not a function of the API

1 Like

Yeah i mean i donā€™t know either. I found a way to download the list file as is, but theres no way to reupload it, i thought with the ability to see the complete list wed have the ability to edit it as a whole. But who knows. Corssing my finger for a reply.

1 Like