[CustomAPI] Quote system

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

Hey @OneLostHero!

I had to manually edit entire quote lists a few times because we changed how we formatted our quotes, with around 200+ entries each time, so far there’s no other way to do it, sorry.