NightDev Community Forums

[CustomAPI] Quote system

u can replace the
$(querystring)
with
$(eval "$(querystring)".replace('%40',''))

u could create a second quote system and then for your “!quote” command use…
$(eval a="$(urlfetch https://twitch.center/customapi/quote?token=TOKENONE&data=$(querystring))";b="$(urlfetch https://twitch.center/customapi/quote?token=TOKENTWO&data=$(querystring))";r=[a,b];d=r[Math.floor(Math.random()*r.length)];if(a[0]==0){d=b};if(b[0]==0){d=a};""+d)
being sure to replace TOKENONE with the 8 digit token from the current quote system and TOKENTWO with the new 8 digit token from the second quote system :wink:

NOTE: this will successfully retrieve a quote at random, or search by words… but if u try to search by quote number u may or may not get the one u want…
if u would like search by number functionality i can do it, but it’ll require a 2nd command linked by alias…
first command (i would name it “!quote”)…

$(eval a="$(querystring)";b=a;if(a==a*1){c=a*1;if(c>2000){a=0;b=c-2000}else{b=0}};""+a+" "+b)

and for the second command linked by alias (i would name it “!quotepart2”)…

$(eval a="$(urlfetch https://twitch.center/customapi/quote?token=TOKENONE&data=$(1))";b="$(urlfetch https://twitch.center/customapi/quote?token=TOKENTWO&data=$(2))";r=[a,b];d=r[Math.floor(Math.random()*r.length)];if(a[0]==0){d=b};if(b[0]==0){d=a};""+d)

little late but added this today for delquote and editquote, let me know if it works as expected.

1 Like

Is there a limit of 2k qoutes on the list? And if there is in there any way to make it so it deletes the first qoute and adds a new one?

i’m not sure about the limit, never had that many… but if u do hit a limit (only do this after hitting the limit or u will erase the first ones for no reason)

for your addquote command, u can do it 2 ways…

the first way will tell u what quote is being deleted…
$(urlfetch https://twitch.center/customapi/delquote?token=YOURTOKEN&data=1) $(urlfetch https://twitch.center/customapi/addquote?token=YOURTOKEN&data=$(querystring))

if u don’t wanna see that, or if u have really long quotes that will trigger the over 400 character limit error, the second way will not tell u what’s being deleted…
$(eval "$(urlfetch https://twitch.center/customapi/delquote?token=YOURTOKEN&data=1)";"$(urlfetch https://twitch.center/customapi/addquote?token=YOURTOKEN&data=$(querystring))")

in either case make sure u replace the “YOURTOKEN” with the alphanumeric token already in your addquote command

Yes there is a limit, mostly to reduce abuse. If you have a legitimate usecase, message me and I can increase your limit.

it works perfectly for editquote, but delquote gives me an “invalid index” error when i try to use negative numbers

When the quote command is used streamlabs and night bot display commands. Can I turn streamlabs quotes off and just use nightbot?

This forum isn’t really about streamlabs, but you should be able to yes.
Again, not an expert, but go to the streamlabs dashboard, under Cloudbot I guess, and look around for a ways to delete/disable the quote command. Maybe here?
https://streamlabs.com/dashboard#/cloudbot/commands/custom

EDIT: Alternatively, you can disable Streamlabs bot entirely, generally using one bot makes more sense, having two leads to a lot of collisions like that.

1 Like

$(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):wink:

Hi there! :blush: is there any way to make the above command shorter? I’m using this on YouTube as well as twitch now. Working brilliantly on Twitch. But 23 characters too long for YouTube. The rest I’m using from this forum are great though.

It’s pretty compact as it is but I would suggest adding it through the nightbot dashboard to avoid the limit.

Is is correct that on !quote list at the end of the list there is a $(querystring))?

Hey @diebohne444!

If you mean the following command:

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

Yes, it’s normal, it’s useful to look for a specific quote through the entire list.

No. I opened up the quote list via “!quote list” in Chat and suddenly there was $(querystring)) in the list and when i wrote !quote 7 (where it was positioned) the Bot send that into Chat

Is there any way you can screenshot all of this so we understand better?
Both the screenshot of the chat and of your list.
Blur/mask the tokens if it’s the private token (16 characters).

Right now the list is clean, but before we hit the 10 Quotes it appeared a few times. I will send u a screenshot if it appears again.

did u happen to copy paste the “addquote” command into discord? … discord attempts to grab the site and display a preview, which causes everything after the = to be input into the quote list, and since discord isn’t nightbot, the command variables have no effect and just appear as text

That makes sense. I did copy paste it into my private Discord server, so that i have the links on demand if needed. Thanks a lot

Hi,

Loving the command, thank you.

So I am using the command as a RAID list for Destiny. I have !addquote and !delquote aliased with !joinraid $(user) and !leaveraid $(user) so all it will do is pass their username to the list, or look for an entry with their username to remove. Really simple and exactly what I need.

However, what would be great is if running !joinraid twice for example could not post because there is already and entry (“quote”) that would be exactly the same.

Hopefully that makes sense. Is that even possible?

Also, is there a way to see TOTAL entries in the list? So like !quotes total would say there are 6 entries in the list, for example?

Hey @Oaks!

Yes you could have a !total command to know the length of the list if you add a comma after the name and then split the output of the $(urlfetch) with them, but I think the Queue API fits better your use case here.