[CustomAPI] Quote system

Asked Apr 2, 2016·555 replies·Last activity 7 months ago·Open in Discord ↗
Archived from the original community forum
Things may have changed since it was written. Still stuck? Ask the community on Discord.

Introduction

This custom api adds Quote functionality for your channel through nightbot.
It allows you to add quotes, and have users request random or specific quotes.

*Warning: This is meant to be a system for adding quotes in Twitch chat, and not an arbitrary database. There is no guarantees for uptime or data retention. I reserve the right to limit and boot off any abusive use of this API at anytime. If you want a database, please host your own custom API.*

Automatic Installation

For this method, you need to be the owner of the channel.
Also, make sure you don't already have any custom commands named
!quote, !addquote or !delquote, as they will be overwritten.

All you have to do is visit this webpage, and sign in with Nightbot.
It will automatically add those 3 commands to your channel

https://twitch.center/customapi/quote/nightbot

Manual Installation

This method is for those who are very familiar with creating and editing complex commands.
If you're a mod of another channel, if you want to customize the commands, or use another bot,
you can manually add the 3 commands yourself. Be careful though, if you do it through chat
and someone sees your secret token, they will be able to modify your quotes.

Simply go here to generate the 3 commands: https://twitch.center/customapi/quote/generate

Make sure you set the userlevel for addquote and delquote to moderator only.
EDIT: You can now add &no_id=1 to the url to disable numbering on quotes.
EDIT2: You can now delete ALL quotes by adding &clear=1 to !delquote command.
EDIT3: You can now silence non-error responses ("Quote added successfully") with &silent=1

Usage

Get a quote

This one is usable by anyone, and there are 3 different ways to use it.

!quote

555 replies

This will return a random quote

!quote 4
This will return the 4th quote in the list
You can use negative numbers (-1 would be the last quote)

!quote cookie
This will return a random quote containing the word "cookie"

There's also a special command:
!quote list
This returns a webpage with all the quotes in a list

Add a quote

To add a new quote, you simply pass it to the !addquote command:
!addquote This is a new quote!

Remove a quote

There are two ways to remove a quote. Each quote when printed has an id, so you can use that:

This will delete quote #5
!delquote 5

Or, you can specify a substring of the quote, it will only delete it if there's only one match
!delquote new quote

Editing a quote

This hasn't been fully tested yet, and it's not automatically added as part of the "Automatic install", but you can manually add a "!editquote" command pointing to http://twitch.center/customapi/editquote using the private key. The syntax is:
!editquote [id] [new quote]

So for example:
!editquote 5 new quote replacing quote #5

Common issues

I accidentally got rid of my !quote command

If you still have access to the private token (used for !addquote/!delquote), you can recover using:

https://twitch.center/customapi/quote/recover?token=<private_token>

Unicode characters don't work

Nightbot handles special characters fine, you may not have installed the commands properly. If you're using another bot, you need to lookup documentation for that bot and contact them, as they behave differently. For example, on StreamElements bot, you need to use $(queryencode $(1:|' ')) instead of ${querystring}.

I'm getting 500 error

There may be something wrong with either Nightbot or my servers. Wait a bit for transient issues; if it persists, feel free to DM me on Twitter.

Suggestion / bugs

This is fresh out of the oven and hasn't been thoroughly tested yet.
If you run into any strange behaviors, feel free to make a post here.
Similarly, if you have any suggestion for extra functionality, feel free to leave a comment.

Just set this up for a streamer who used to have a bot setup for quotes but no longer does. This worked via manual installation just fine, haven't seen any issues so far (haven't used it extensively obviously) and actually seems a lot more expansive than most quote systems on other bots. Nice job!

is there a way to customize this so that instead of using !quote, !addquote, and !delquote, we can use something like !darren (or anything specific)? What im trying to set up is a system so that you can add quote-sets for different regulars in a chat.

For example:
!darren would return a random quote from darren.
!john would return a random quote from john.
!barry would return a random quote from barry.

How would I need to customize the command to be able to do this? Also, is there a way to remove the number of the quote in the response? Right now, any time i use !quote, it's returning something like "3. TestQuote"; I'd prefer it just say "TestQuote"

You can achieve that using manual installation. If you go to the generate page, it gives you 3 commands. First is for getting a quote, second for adding and third for deleting.

Go to the nightbot control panel > commands > custom, and manually add 3 commands (!john, !addjohn, !deljohn) with the 3 commands respectively. Make sure to set !addjohn and !deljohn to moderator only.

Then, refresh the page the generate page to get a new set of links, then repeat the same process again for barry and darren.

Currently there's no way to remove the number. You kinda need to for knowing which quote to delete. You can delete quotes with words but it's not a very safe way of doing it.

Awesome! i got the first part to work (unique quote indices), but wondering if there's still not a way to remove the number from the return response.

I understand your point about the numbers being important for when you're deleting quotes & the quotes list, but shouldn't there be a way to have the quote return everything but the number?

When a new quote is entered, it's assigned a number in the list (which will adjust if you delete quotes added before the newest one); since we're adding the quotes without numbers, Im sure there's a way to see the quotes without them. I believe that this would be similar to song lists in Nightbot--Nightbot will assign a song a number when it goes into the queue, but doesn't necessarily show that number when someone issues a command to see what the current song playing is.

I don't have much experience with coding, but if you want to send me a copy of the custom api then I could at least try to take a stab at something. If you'd rather not send it over, no worries...even if we can't figure out a way to remove the numbers, this is still a pretty cool feature!

Here you go:

Simply append &no_id=1 at the end of the !quote link.

It'd look something like so:

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

Hey, I have a problem with server respond. When I add quote and then I type !quote, bot responds Nightbot: Remote Server Returned Code 500. So, how should I repair it? Thanks :)

@Calm Peacock Thank you for reporting the bug! There was an issue with Unicode characters, it could be fixed now.

Great job :) Thank you so much. This is the best API i had ever used :)

Hi, is there anyway to delete all quotes at once or do you have to go one by one?

I actually did add something for that, forgot to document it here, I'll add it in a bit.

In the meantime, refer to this post:
(link expired)
If you have any questions, as how to set it up, feel free to ask.

Any idea how to add a quote with a specific number? For example, if I deleted quote 1, and there are quotes 2 and 3, how do I add a new quote in the space of quote 1 without it becoming quote 4?

If you delete quote 1 quote 2 becomes quote 1. All the way up the line, the rest of the quotes fill in the gap.

Is there any way to make nightbot say random quotes using timers?

Yes, actually. In your timer if you set the alias to be your !quote command or if you set the message field to be customapi/urlfetch for the quote grabber missing the $(querystring) variable it will always pull a random quote for your timer to send out.

Put:
$(urlfetch http://twitch.center/customapi/quote?token=TOKEN&data=)
Just to be safe

looks like there is some kind of problem if there are too many quotes...
i've added more than 1000 quotes and nightbot seems to have problems retrieving some with higher numbers 😕
Is it expected behavior? Is there optimal quote limit?

Can you give your channel and specific command that fails?

Worked fine when I tried the commands on Twitch. I tried 800, 900, 1000, and many more and it all returned perfectly. Youtube doesn't let me type in your chat while you're offline so I can't test there, but it seems like it's an issue with Youtube, maybe specific the links you have in your quotes?

There are more than 500 diferent links on my quotes (all adult...), could be them, but seems random...
Sometimes works, sometimes don't 😕 And low numbers, like 100, 200 seems to always work.

I think there is way to test on youtube, using the gaming.youtube system: https://www.youtube.com/live_chat?is_popout=1&v=wAzL2VuybxA

Edit: After some more testing, looks like i'ts youtube's fault 😦
Short links are working, bigger ones that have "<wbr>&shy;" are not, and they were before...

You're right, it is a YouTube problem. I'll reach out to their developers.

Sorry for the delayed response. YouTube developer reached out to me and stated that this bug will be fixed by them in their next release.

gonna hope they don't take too much time... It's very limiting 😦

I started getting "Remote Server Returned Code 500" when deleting quotes from the list.

EDIT: After a while the quote seems to be deleted from the list but still, the behaviour is quite weird.

I see the bug, should be fixed now.

I'm actually using this for a queue system instead, and it's more effective than anything else I've tried. Would it be possible to add a command to display all quotes (or queue'd entries in this situation) directly into the twitch chat? Can't use the !quote list command as it would be posting the token for all to see, and having it post directly into the chat would be more convenient for this purpose. Thanks!

There are two tokens, a "public" token, and a "private" token.
The one that is given out when you type "!quote list" is the public one,
and it's safe if people get to see it. The private one is only used in "!addquote" and "!delquote".

Posting in chat is very limiting because:
1. There's a character limit
2. There's no new lines

Ah, I see. That should work just fine then, thanks.

Is there any way to use "sub strings" on timers? Did not worked when i tried 😊

for disabling the numbers, what are you supposed to add the string of text to specifically? The website or the command itself?

I'm having a weird problem where, when the quote system is being called by Nightbot's Timer, it always returns with "No matching quote found." It doesn't matter if it's calling on an alias command or if the raw command is pasted into the message section of the timer, it acts the same. However, if I call it using a regular custom command it works perfectly. Any ideas?

What I believe the issue is that the required message in the timer is picking a quote that doesn't exist.

To fix this change the $(urlfetch) link to $(urlfetch http://twitch.center/customapi/quote?token=TOKEN) and putting this in the message of the timer. Removing the &data= is fine as that is only used to choose a specific number or list link, both unused in a timer.

Yay thanks for this, no issues so far...

I have an issue with the quote system (after the numbering features such as quote 1,2,3 have been removed) I'm having an issue with the !quote list option as it thinks list is part of a quote and give the "No Matching Quote Found" response

What channel is this on?

And can you show me what your quote command looks like on nightbot?

Yes the code for the !quote command only

The !quote command is displayed as a urlfetch, but the url itself is the same url provided in your post, but with the &no_id=1 added to the end of it. This is the knowledge you requested, correct?

Great API, one question, is there a way to edit an specific quote, or do i have to delete it and re add it??

You would have to remove and readd. Don't support edits yet.

Is there any possible way to make nightbot show random quotes over time? I tried to make a timer in the settings, but whenever the timer triggers it only says "No matching quote found". I guessed it would work, because when I write the !quote command, it returns a randomly chosen one, but when the nightbot writes itself, it only returns that message. Thanks!

Its most likely due to lack of proper data in the message field. If you have any text it will run the !quote command with that text.

To fix, simply have the timer run the urlfetch with the quote api in the message field instead of a timer. Use this link instead http://twitch.center/customapi/quote?token=[TOKEN] (with the token replaced with the one in your !quote command). It should post a random quote and due to the data field being blank it should fix the issue you are having, as it won't search for a command.

Hi I am moderator with access to my streamers channel nightbot. She has added the Quote system and I have tried all of the methods above to try and help her get her nightbot to show the random quotes. They either provide the No matching quote found, Missing "token" argument, check installation guide or some variation. Sadly none of them seem to work for hers. The last one of the missing token was with following @Sparkly Hamster not sure if I mixed up order of the token vs the token number from the !quote command. Any help is greatly appreciated. Thanks.

What if you append &data= at the end.

Thanks so much and the screenshots helped as well. I think I was using the wrong token was trying the non public one even with the format you posted here and had the no matching quotes found. Then I looked at what you put here and the screenshot and discovered it was the "everyone" quote code it needed and that by having the !quote command not in the part where it asks for a command to trigger it worked. Thanks everyone for all the help.

what does your quote command look like? Your add and delete look fine, but you probably have an error in the !quote one

EDIT: It should be:

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

And yes, this token can be shown publicly, it's different from the token used for add and delete.

That's fixed it! The token WAS messed up on Quote. Thanks so much.

Instead of using the public token to build a list in twitch chat, can it take the user to an external link (similar to the DJ song list). The reason for this is because I want to display all quotes to them (using it as a Rocksmith 2014 song request list) possibly using an external site or document. If my stream were popular and I had 100 song requests I can't show these to the users without dumping a ton of text into my twitch chat which would result in missed messages and would look ugly.

That's what the link generate when you type !quote list does. It gives a link using the public token, and when the user goes to that link, they see a full list of all the quotes.

Hi there! Loving the system.
I was wondering if there was a way for one command to grab the $(query) information from a previously used command. I wanted all user levels to be able to suggest quotes, but I don't want them to be automatically added without mod approval.
For example:

User#1: !suggestquote Farting is funny.
Nightbot: Farting is funny.
Mod: !acceptquote
Nightbot: Successfully added quote #1

So !acceptquote would be similar to !addquote except that it would take what User#1 wrote without the mod having to retype or copy/paste the suggested quote. Hope that's clear. Thanks! <3

I don't think it's possible with the current technology, and also, this could be annoying if someone suggests another quote by the time you go to type accept. You can still have some sort of suggestion, and then admin would have to manually type "!addquote <paste quote>" which is a bit annoying but yeah, sadly it's the best that can be done right now.

If you really really insist, it wouldn't be too hard to have a pair of custom api, one that just takes an input, and another API that gives you back the last item submitted to the API. I could see this being useful in other places I guess.

@Agile Elephant if I am using your quote system to generate highlights like @Tidy Chipmunk explained on another thread and I wanted it to also generate the stream title into the thread how would I go about doing this? Also if it matters I'm using it to generate highlights for friends stream I am mod in not my own. Thanks in advance!

If your using my example with

!commands add !addhighlight -ul=moderator -a=__highlightadd [$(time America/Denver "MMMM d | hh:mm a")] [ $(query) ]

Then just add $(twitch $channel "{{title}}") anywhere after a=__highlightadd

So !quote list just works? Or how do I set that up

Trying to make !delquote moderator only

Where do i have to add -ul=moderator to do so? Where I have it currently is giving me invalid output from nightbot

(if you could show in the full string) <3

is -ul=moderator even correct in this? or am I to use $(userlevel) and if so where should that go then?

This is how you would add the command in chat:

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

All modifiers -ul= -a= -c= go after the command name (!delquote in this case) you can read about that here: https://docs.nightbot.tv/commands/commands at the bottom

If you do the automatic at the top, it should take care of that for you (although only the channel owner can do it).

Also, you can use the nightbot control panel site to do it, which provides you with an interface which makes it easy to set these kind of extra options. You can also edit old commands to make them moderator only.

I plan to use the Quotes for stupid things I say on stream. I added the time a quote was entered by adding:

&data=On $(time America/Denver) name said: $(querystring)) to the !addquote command.

It produced the following when I typed !quote: 2. On September 29th 2016, 4:54:47 pm MDT GMT-06:00 Greyhart said: Testing, testing...1, 2, 3!

I thought I'd put it here in case someone wants to do something similar. You can play around with formats, if you don't want the entire date/time.

P.S. Thanks for the commands! They work great!

Could you tell me how to modify the !addquote command to add a timestamp and the game that was played? I've been trying to work it out myself, but not had much luck so far ^^
Really appreciate this API, it's brilliant 🙂

@Sturdy Bear

Sure, here's a few things you need to pick first:
1. What timezone do you want the time in. In my example, I'll use US/Pacific. Here's a full list:
https://en.wikipedia.org/wiki/List_of_tz_database_time_zones
2. How do you want that datetime to look. Here's a short table for common formats:
<img src='>
There's more advanced one, but I'll pick "L" for the date and "LT" for the time.
3. How you want it to all look. For my example, I'll go "[TIME] [GAME] quote"

Here's what the data segment looks like
&data=[$(time US/Pacific "L LT")] [$(twitch $(channel) "{{game}}")] $(querystring)

It's a bit complicated, but all you need to change here is US/Pacific, and maybe the "L LT" if you want a different format. You can also try changing the [ ] and the order but be careful.

Then, the FULL thing looks like this:
$(urlfetch http://twitch.center/customapi/addquote?token=MY_TOKEN&data=[$(time US/Pacific "L LT")] [$(twitch $(channel) "{{game}}")] $(querystring))

Except I replaced my token with MY_TOKEN.

Hope this helps.

xsvCwNe.png

Thank you! I was just struggling to determine how to add the time part and couldn't fine the game command. Really appreciate the time you took to put this in:)

I only see one quote right now, unless you removed that.

If you call "!quote" it give one randomly. If you put "!quote 1" or "!quote 2" it'll give that quote

Yeah that is the issue. Only one quote shows up in the list but I actually have 3 entered in. See below:

CremasterContusion - Today at 12:35 AM
!swquote 1
NightbotBOT - Today at 12:35 AM
Exanimus is a death cult obsessed with become undead. They have taken a technological approach in using cyberware to keep the body just barely alive.
CremasterContusion - Today at 12:35 AM
!swquote 2
NightbotBOT - Today at 12:35 AM
The Trade Federation is a sovereign, neutral agency that protects the FTL lanes from piracy and ensures fair trade. Similarly, they are the galactic equivalent of a police force.
CremasterContusion - Today at 12:35 AM
!swquote 3
NightbotBOT - Today at 12:35 AM
Ron Schlotskie, Residential Badass. *Puts on purple slotted shades and motors away.

Do your magical coding abilities know no bounds?!? What a time to be alive! :cold_sweat:

Hey @Agile Elephant,

One more issue with nightbot. When using the call in nightbot's timer it returns Nightbot : No matching quote found

But if I run the command manually with the same call it behaves as expected. Any idea what the difference could be?

Are you sure you made the timer properly, and there isn't an extra space at the end. Honestly I should probably strip extra spaces, that might fix your issue.

Yeah no spaces. Exact string that we had before entered into the timer.

Yeah, you can't use variables in timers. Here, $(querystring) get's replaced what what the person puts after the command in chat. But in timers there's nothing. So basically just remove that.

$(urlfetch http://twitch.center/customapi/quote?token=8df3f178&data=&no_id=1)

Interesting. I removed that before and still got the same thing. :( But I'm trying it again

Yeah it worked. Damn. I totally tried taking that out and it didn't seem to work. Thanks again Ehsankia!

It's working great for me, I've added it to 2 of the Channels I'm a Nightbot Editor for, I'm Just wondering if there's a way to just have month/year without a Day for the time stamps? I don't see it in the list of common variables

Edit: I Just realised it's a normal Nightbot $(time) command, DOY. I found it... Still This is a great API, Keep Up the good work 😃

Getting "no matching quote found" again. 😦

This time it is on my other list: http://twitch.center/customapi/quote/list?token=d49fff23

Timer Query: $(urlfetch http://twitch.center/customapi/quote?token=d49fff23&data=&no_id=1)

This seems to be working fine with the Timer Query you posted.

Figured this out. I had an alias defined in the configuration of the timer. Case solved.

blob.png

When adding a quote to the bot today, I'm getting "Remote Server Returned Code 500". But I can retrieve and delete quotes, just not add this one for some reason. !addquote Either that, or Duncy hasn't had a chance to harden for a very very long time.

Any idea what might be causing this? Otherwise I'm really happy with this API! Thank you for developing it :D

Interesting, it has to do with the game you're playing (Pokemon) and the fact that your quote automatically includes the game name. More specific, it's the "é" in the name. But the bug isn't with you, it seems like nightbot $(game) is sending the game name with the wrong encoding. It seems to be latin-1 instead of utf-8?

@night can you look into that?

Aha! That makes sense for sure. Thanks for looking into it :) Is there a way I can add it manually? I like having the game and time added to the quotes so that we have a referencepoint.

@Agile Elephant do you have a quick repro for the issue? encoding is already utf8

The way I have it is:

$(urlfetch http://example.com/?data=$(twitch $(channel) "{{game}}"))

And my channel game is set to any Pokemon game with é in it.

And my server is receiving data=Pok%E9mon

\xe9 is a valid latin-1 character, not utf-8

Should I be wrapping the $(twitch) variable in some query variable?

Yes, you should be wrapping it in $(querystring).. so $(urlfetch http://example.com/?data=$(querystring $(twitch $(channel) "{{game}}"))) should work I think

Works, though using $(channel) was giving me "unknown twitch channel". Is there a nest limit for variable? Because this is 3 layers deep (twitch inside querystring inside fetchurl).

I hardcoded my channel name though and can confirm the unicode bug goes away.

so try that @Sturdy Bear, surround the $(twitch) variable with $(querystring) and you may need to replace $(channel) with your real channel name.

$(urlfetch http://twitch.center/customapi/addquote?token=redacted&data=$(querystring) [$(time Australia/Lindeman "L")] [$(querystring $(twitch $(channel) "{{game}}"))])

if that fails replace $(channel) with your actual username.

Thank you very much for the help! I had to add my actual username, but then it works perfectly.

I really appreciate the support and help given here, by all three of you. Thanks again :)

@Tidy Chipmunk @Agile Elephant if I want it to call on it in chat as a Highlight instead of saying Quote added how would I go about doing this?

Is the issue only the reply, saying Quote added instead of Highlight added? Unfortunately that's on my end and I can't really change it without making this API much more complicated

yeah that was the only thing. was just wanting it to be a bit more uniformed and look a little cleaner in chat. I figured it was probably something I wouldnt be able to do but figured I would ask anyways. thanks for the speedy response!

Hi!
is there any chance tu use the list on OBS BROWSER?
with autoupdate?

Just wondering how one could modify this into a !kills list instead?
It's for a DayZ streamer and while it's easy to just implement the quotes system with a different command name it'll still return "Successfully added quote #", which I'd also like to get rid off.
But, the main issue is that I'd like to make it work like this: A mod updates the command with !addkill and a clip link, the old kill that was there gets moved onto the list that's fetchable with !kills and the new one (so not a random one) gets fetched by !kills.
So basically, I want the word 'quote' replaced with 'kill', and I need it to always fetch the newest kill off the list, because there's also a !lastkill command into play that has to do that. I'm stuck with that, pretty much. I thought about using the ´$(count)´ variable but I don't think it's possible to tie the ´$(count)´ from another command into that ´!lastkill´ one.

Thanks in advance!

I've got an idea for your !lastkill command:

Have another bot with a count variable (ie. Ankhbot) join the channel and make sure the streamer has added it as a moderator.

Assuming you're familiar with Ankhbot custom commands, you can set up a command on Ankhbot called !addkill such that after Nightbot has added an entry to the kills list, Ankhbot will respond with "!editcom !lastkill (whatever text you want here) $(urlfetch http://twitch.center/customapi/quote?token=(YOUR_QUOTE_TOKEN)&data=(ANKHBOT_COUNT_VARIABLE))"

What this essentially does is change the entry ID search in the !lastkill quote API every time someone uses !addkill

Make sure to make the Ankhbot !addkill command moderator-only.

This may not work if Nightbot can't react fast enough to different commands in such a short time.

Let me know how it turns out! 🙂

functionality was already added so that two bots aren't needed to a grab the entry in the list.

Now if you simply call !quote -1 the last added entry is shown. Instead of worrying about two bots keeping counts and any nonsense like that

Thanks for the tip! Didn't know you could input -1 for the most recent entry.

So I guess the syntax for @Silky Dolphin 's !lastkill command could just have -1 in the data parameter for the quote API then.

Correct. That feature was added because of his request.

And to be more specific, you can keep going further negative to get the 2nd last result and so on. I'll add it to the documentation at the top.

Can I do like an automated list thing that when somebody says !jq he will automatically get to the list which only moderators can see by typing !list?

Example: A guy named Josh comes to my stream and says: "Hey, are you doing art for people?" Then he types !jq and my bot says: "You have been added to the queue in position #?". Then I can see who is next in the queue by typing !list or something.

My mods are now taking care of the list by just editing the !list command manually which is really, you know, not the best way.

if you make !list a command that does !commands add !list -a=!quote 1 replacing !quote with whatever you set your original quote command to be, it will list the first person in the list.

You could then similarly make a delete command that pops the first person off the list: !commands add !pop -a=!delquote 1 replacing pop with whatever you want to call it and delquote with whatever the command is for deleting individual quotes. Doing this automatically re-sizes the list, so number 2 becomes number 1, etc etc. So !list will work fine after deleting.

@Sparkly Hamster Now I got everything working except when you type !list it only shows the first person on the list. And when I do !editcom !list -a=!quote list it says the website where you can see the full list. But can you make the command !list so it shows the full list without going to the website?

No, because the list can be any size and there is no formatting supported. The services only allow a certain amount of characters in a single message and i believe in nightbot restricts customapi's to returning 400 characters. The link to the website is the easiest way to give the most information to those who need it.

I was able to modify the commands to use this as a list for listing things. How would I go about modifying it, if I wanted to add something to the top of the list and have everything move down. For example,

1. John
2. Steve
3. Frank

I want to know add Jason to the list but he gets to be #1.

That isn't really possible with the quote api. Things are added in chronological order and the order only changes when something gets deleted (everything below the deleted thing moves upwards).

Why do you want/need to do so?

I am using the "queue" system as a list for participation in our groups. So people sign up and we had them to the list. Certain activities, like donations, winning a raffle, etc. would get a person to be #1 on the list. I was unable to find any other custom APIs for lists and do not know how to do it myself and this was the best way I was able to find.

Hi, I can add quotes to my private token, but when I try a !quote it says no quotes added, I tried to see my quotes replacing the token on !quote list, it also says no quotes added..
I can add and remove quotes with add/del commands..

"!quote" takes the public token, not the private token. And the private token and public token must "match" as in generated together. Are you sure you installed it properly?

Try generating a new private and public token, add a quote using the private token, and check the "!quote list" using the public token.

Agile Elephant said:
&no_id=1

I generated a new one and made a manual installation, works fine now, something was wrong with the automatic installation.

Also, will there be a problem if I generate more than 1 token for my channel? I have somethings set in mind that I need aleatory responses to it, this quote system would work perfectly.

would it be possible to edit a quote after already creating one. If so how can I go by doing that. It would be really helpful. Thanks

@Maple Kangaroo Hmm I'll look into automatic installation to see if something has changed. And yes feel free to install multiple ones (within reason).

EDIT: Just tried automatic installation and it worked fine for me. Not sure what the issue was for you.

@Amber Kangaroo I did add quote editing a few days ago per someone else's request and haven't documented it here yet. It's not fully tested, and has to be installed manually, but if you send an /editquote request, with the index followed by the new quote, it'll work.

so !editquote 5 this is the new quote with !editquote pointing to http://twitch.center/customapi/editquote, with your private key.

would this work for integrated places such as discord? or would I have to enter something else for that to work?

Do you mean nightbot for Discord? I don't see why it shouldn't.

Yes that's what I mean. I tried it on discord but it doesn't seem to do anything.

I think I'm missing something. I'm not sure

hi~ it is great but $(user) cant function normally it cant work with &data=On $(time Asia/Hong_Kong "L LTS") $(user) said: $(querystring)) but can work with &data=On $(time Asia/Hong_Kong "L LTS") $(touser) said: $(querystring)) (youtube) it return "a Remote Server Returned Code 400"

if it can support $(user) it will be really perfect, i will give 100/100% for it !! (≧▽≦)❤

$(user) breaks if the name contains unicode characters I'm guessing (localized names on Twitch) since it's not inside the querystring and it's not being url encoded.

Is there a way to pull up the full list of your quotes? I would like to print it out so I don't have to try to remember which quote was 10 or 15.

If you used the default commands or set it up automatically you can use !quote list and it will give you a link to your list of quotes.

However it sounds like you may make use of keyword searching. !quote [keyword(s)] will also search for quotes containing the words you use. So you don't need to remember the number if you remember something specific about the message.

That did it! Thank you so much

so how can i solve it? is it possible to solve it? (X (the name really contains unicode characters haha..) I'm really great to see if i can use $(user) in the quote system ~~ ^ ^

and if it is possible add a &defdata ? haha, (if no any entry after !quote ,it will show the default quote )

The current behavior is that an empty !quote will return one of your quotes at random.

Hello! First of all thanks for this wonderful api! I love it. I just have a few questions.
I did it the automatic way but changed the commands later on through nightbot.
I replaced 'quote' with 'chrystalball' (add, del, edit).

The thing is I have added 11 Quotes for testing purposes and it seems to always
repeat the same Quote over and over? The thing is, the first 3, 4 tries it seems to work
but no mater what I type always the last added quote will be used.

My other question is can I trigger that command without '!' or do I always have to type
!chrystalball. I am pretty new here but I think I have seen that it can be triggered without '!'.

And does it have to stay at first? Like: Chrystalball what's up? <> What's up Chrystalball?

A lot of questions but I really appreciate your work!!!

It does have to be at the start, but you can remove the ! if you'd like from the command name.

try typing !chrystalball list which gives you a link to all your entries. If it's in there, it should show up. If you can show through thorough testing that it doesn't, then there's a bug which I'll try to fix.

Looks like you got the ! working, and in my trials, it seems to get all 11 of your quotes?

Screenshot_2017-03-16_at_11.09.46_AM.png

@Agile Elephant In a quote list of 7 quotes the commands "!quote -7" to "!quote -1" access the quotes saved in the spots 1 to 7 respectively with the numbers -6 to 0 associated to the quotes. Additionally "!quote 0" always seems to access the last quote in the same way "!quote -1" does. I assume this behaviour is the same for any length list, although I have not tested it further.

The "!quote" command also accessed the last quote with the displayed index 0 once, that was immediately after I had added that exact quote and I have not (yet) seen it happen again.

This really is a non issue, just thought it interesting when I tested the system and mayber something that's easy to fix.

Either way thanks for the work on this!

Negative index working backward is a feature. It was for someone who wanted a command that always prints the last quote, so I added -1, and also made negative numbers index from the end of the list. And yes it works on any size of course.

I'll have to look at the code but I'm not sure if index 0 has a well defined behavior.

Is it possible to get multiple results from our !command [keyword(s)] intead of just the most recent matching?

I don't think it's the most recent, I'm pretty sure I had it so it randomizes between all matching results.

So if you have 5 quotes containing "banana" and you type "!quote banana" you'll get one of the 5 at random every time. if you're looking for a more specific quote, try typing more keywords?

Multiple doesn't quote work. Quotes are limited to 400 character, which is also what happens to be roughly the limit for a single twitch message, so returning multiple doesn't work. Also, the bot api only let's us return a single reply, not multiple. We also wouldn't want nightbot to spam 20 quotes in a row either.

I get it, for me i'm using it to store clips. so I'd like a search to return a few clips with matching keywords, but its cool I understand. at least i know its random now 😃

Hey,
Is there anyway I can edit quotes? I have my quotes set up chronologically and sometimes I make mistakes but can't edit it. If I delete the quote and re-add it, it'll be last and it'll look weird as some quotes before it would have later dates!

Also,
Is there a way to search for a number? When I do !quote 10 it brings up the quote in 10th position but I want it to bring up the quote containing 10!

If some could help me to do any of the things above I'd be grateful!

Add a !editquote command similar to !addquote but to the /editquote endpoint in the api. Then do

!editquote 5 new quote

to edit the 5th quote

Ok thanks, but do you know if their is a way to do the second thing?

Oh ok! Is there any chance that you'd implement it, or no?

hey am lost after make the command !editquote what messgae to i put in

@Glad Buffalo Doubtful, there's no clean way of doing it.
@Amiable Flamingo This is advanced customapi setup and it's kinda beyond the scope of this thread.

Is there any chance that you could send me the code with instructions on how to edit it (or preferably with the changes already made)?

could there be a way to show the total of quotes without having to go to the quote list every time?

You mean a command to show the number of quotes?

Basically yes. Just a command to show total quotes made

Alright, added !quote # that gives you the count of entries added.

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"))

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

@Quirky Beetle -- For example if you wanted to add the "Add quote" command, and have only Moderators be able to add quotes, the command would be:
[code]
!addcom !addquote -ul=moderator $(urlfetch http://twitch.center/customapi/addquote?token=YOUR_TOKEN_HERE&data=$(querystring))[/code]
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.

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).

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

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 :)

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.

Hey,

i think the delquote/addquote should be:

But i tried to recover it myself, and it didn't help.

I only had 12-14 Quotes on my account. That's all. Maybe it is easy to find them.

I guess you're not gonna use this anymore so it doesn't matter as much, but in the future never post your private key publicly. I backed up your quotes but someone could've gone and deleted them all if they were faster than me. In the future PM it directly instead.

Here's the quote that were until that token:
https://pastebin.com/yyUZkteW

If these aren't it, then they're probably lost.

Oh and make sure to change your add/del quote commands after this.

Thank you very much.

That are exactly the quotes. I will change my commands. Thank you very much for your kind help!

I appreciate it very much

can you give me the list url of token=2? i want complete this command
the code have 223 word but commands only can enter maximum 200 words
the solve sulution is decrease the length of value "r"
and please open the $(touser) write permission,let regular and moderator also can write

This is a check in syetem code
$(touser)$(eval var p="$(touser)",q="$(urlfetch https://goo.gl/WFDDfh)",r="$(urlfetch http://twitch.center/customapi/addquote?token=2c918790b386a896&data=$(touser))"; if(p==q) {("今天已簽到,請明天再來!"); }else{("已簽到,獲得50個932幣"); })

2017-08-14_174704.jpg

@Agile Elephant -- I was wondering... Is there any way I can make my !addquote command not spit out the message "Successfully added entry #"? I wanted to have Nightbot say a custom message when the entry is added, and for the most part I've managed so far, but along with the custom message Nightbot also responds with the successful bit...

Thanks a bunch in advance!

That's a great idea! I also want do that

@Quick Turtle: In the mean time you can do what I did and use the str.slice() method to cut that message out of the response. But it'd be nice to have an option and not have to add extra code into the command :P

I have a quick question. Would it be possible to get two quote commands running under different names? Because I would like to have a quote command for quotes... Big surprise there haha. But I would like to have a second one for drink recipes. So If someone would use !drink negroni, the recipe for a negroni would show up in chat. Is this possible to do?

@Cobalt Rhino, yes, manually install another set of quote/addquote/delquote commands with a new token, but with a different command name, such as !recipe, !addrecipe, !delrecipe. Just press the manual install and it generates a new set of keys.

@Rosy Elephant, Sorry, I'm not sure. If you private message me the private quote, I can look up the exact command that's being send to my server.

I have two questions (and requests for functionality, if there's not already a solution):

1. Is there a way we can make the command not return anything unless the query matches a word in one of the quotes? I've used it to simulate a two-word command (if someone says "I'm cool", for example, it would respond to them with "I'm cool too"), but whenever anyone starts a sentence with "I'm", Nightbot chimes just chimes in anyway because it only has the one quote to work with.

2. Is there a way to name/tag quotes, so that they are only returned in response to a specific word instead of being returned if any word in the quote is matched? I'm curious about this both for the aforementioned situation and just in general, as I'd be more likely to use the quote system as an actual quote system (with another set of keys, of course) if this were possible as opposed to having to request it by number or a phrase contained within the quote.

Thanks for reading and responding.

Just out of curiosity, did you ever figure out a solution to the issue @Rosy Elephant had. I have been trying to do the same thing and have been getting the same result. I have tried just using the command to retrieve a quote, as well as I have tried to use a random number command and then alias to the regular quote command and it also results in Nightbot just pulling the last quote.

Hello 🙂
Is there anyway i can only allow a user to only use the command once unless i clear the whole list with clear=1?

Also is there a way to delete several quotes at once? for instance !delquote 20-40?

Kind regards

Lucky Beetle said:
Is there anyway i can only allow a user to only use the command once unless i clear the whole list with clear=1?

Go to https://twitch.center/customapi/quote/generate. You will see three lines. After token= on the first line, you will see your first token. After token= on the second and third lines, you will see your second token. Use these to replace FIRSTTOKEN and SECONDTOKEN before you add the following commands.

!addquote (alias to !addquoteadder)

$(eval queueString = `$(urlfetch http://twitch.center/customapi/quote/list?token=FIRSTTOKEN)`; userExists = false; regex = /\d+\. \["(.*?)",".*?"\]/g; while ((match = regex.exec(queueString)) !== null){if (decodeURIComponent(match[1]) === `$(user)`){userExists = true}} if (userExists && `$(userlevel)` !== "moderator" && `$(userlevel)` !== "owner") {"?"} else {"?token=SECONDTOKEN&data=" + encodeURIComponent(JSON.stringify([encodeURIComponent(`$(user)`), encodeURIComponent(`$(query)`)]))})

!addquoteadder

$(eval `$(urlfetch http://twitch.center/customapi/addquote$(query))`.includes("Successfully added entry") ? `Your quote was added @$(user)` : (`$(query)` === "?" ? `You already have a quote @$(user)`: `Please use !addquote @$(user)`))

!viewquotes

$(eval queueString = `$(urlfetch http://twitch.center/customapi/quote/list?token=FIRSTTOKEN)`; message = ""; regex = /\d+\. \["(.*?)","(.*?)"\]/g; while ((match = regex.exec(queueString)) !== null){message += decodeURIComponent(match[1]) + ": " + decodeURIComponent(match[2]) + ", "} message ? message.substr(0, message.length - 2) : "There are no quotes added")

Each of the quotes are encoded to include the username of the person who added it. So you'll have to parse each quote before it can be properly displayed. If you want my help with this let me know.

Lucky Beetle said:
Also is there a way to delete several quotes at once? for instance !delquote 20-40?

I don't think it's currently possible to delete several quotes at once, because Nightbot is unable to loop through $(urlfetch)'s.

Sweet i will try to install that!

Is it OK that i basicly made an 8Ball command for nightbot using the Quote system?

Command:
!addcom !8ball $(user) has asked 8ball the Question: ◄$(query)?► 8ball Awnser is: ◄$(urlfetch http://twitch.center/customapi/quote?token=833fab7d&no_id=1)!►

(anybody can basicly add this code without any problems)

Would you improve it in anyway?

For instance. if there is no $(query) given it would reply with You got to ask a question first or something.

Lucky Beetle said:
Is it OK that i basicly made an 8Ball command for nightbot using the Quote system?

Command:

!addcom !8ball $(user) has asked 8ball the Question: ◄$(query)?► 8ball Awnser is: ◄$(urlfetch http://twitch.center/customapi/quote?token=833fab7d&no_id=1)!►

(anybody can basicly add this code without any problems)

Would you improve it in anyway?

For instance. if there is no $(query) given it would reply with You got to ask a question first or something.

It's only necessary to use the quote system for an 8ball command if you have too many responses to fit into the command itself. Are you sure that you do?

!8ball command that doesn't use urlfetch:

$(eval r=["It is certain","It is decidedly so","Without a doubt","Yes definitely","You may rely on it","As I see it, yes","Most likely","Outlook good","Yes","Signs point to yes","Reply hazy, try again","Ask again later","Better not tell you now","Cannot predict now","Concentrate and ask again","Don't count on it","My reply is no","My sources say no","Outlook not so good","Very doubtful"];(`$(query)`?r[Math.floor(Math.random()*r.length)]:"Ask a question")+` @$(user)`)

I didnt even know that was a possibility...

Now i gotta ask. Is there a way to make a Voting system based on your quoting system?

I am seeing quite some endless possibilitys as long as it fits into nightbots command line.

Lucky Beetle said:
Now i gotta ask. Is there a way to make a Voting system based on your quoting system?

That is possible. I have to go now but I can write that command later if you want. But are you aware of the existing !poll command?
https://docs.nightbot.tv/commands/poll Let me know if that fits your needs.

Sadly the !poll command does not alow deleting things that have been done already or adding new things. i would have to redo the poll command everytime.

Edit: i also would like voting to be done in the chat with !vote 1 or 2 or 3

Ivory Mouse said:
!addquote (alias to !addquoteadder)

$(eval queueString = $(urlfetch http://twitch.center/customapi/quote/list?token=FIRSTTOKEN); userExists = false; regex = /\d+\. \["(.*?)",".*?"\]/g; while ((match = regex.exec(queueString)) !== null){if (decodeURIComponent(match[1]) === $(user)){userExists = true}} if (userExists && $(userlevel) !== "moderator" && $(userlevel) !== "owner") {"?"} else {"?token=SECONDTOKEN&data=" + encodeURIComponent(JSON.stringify([encodeURIComponent($(user)), encodeURIComponent($(query))]))})

!addquoteadder

$(eval $(urlfetch http://twitch.center/customapi/addquote$(query)).includes("Successfully added entry") ? Your quote was added @$(user) : ($(query) === "?" ? You already have a quote @$(user): Please use !addquote @$(user)))

!viewquotes

$(eval queueString = $(urlfetch http://twitch.center/customapi/quote/list?token=FIRSTTOKEN); message = ""; regex = /\d+\. \["(.*?)","(.*?)"\]/g; while ((match = regex.exec(queueString)) !== null){message += decodeURIComponent(match[1]) + ": " + decodeURIComponent(match[2]) + ", "} message ? message.substr(0, message.length - 2) : "There are no quotes added")

Everything seems to work but the quotes themselfs are not being added.
(i copy pasted them from your post not the lines u see in this quotation of your post)

test.PNG

I've tested the commands, and they work. Make sure you are copying the commands exactly and replacing all FIRSTTOKEN AND SECONDTOKEN

Ivory Mouse said:
I’ve tested the commands, and they work. Make sure you are copying the commands exactly and replacing all FIRSTTOKEN AND SECONDTOKEN

My Bad :) i made a mistake. it works now :)

Ivory Mouse said:
That is possible. I have to go now but I can write that command later if you want.

Yes :D i would like that very much :)

This is what i have build right now.

I used one generated string to design a set of 12 quotes all named Empty.
And i used another generated string to make a !votelist command for users to know what can be voted for.
Wich i can change by using (this would be !changevote1 <input> , changing both quote 1 and 7, there would be 6 identical commands for 2/8, 3/9, 4/10, 5/11, 6/12):
~~~
$(urlfetch http://twitch.center/customapi/editquote?token=STRING&data=1 $(querystring))$(urlfetch http://twitch.center/customapi/editquote?token=STRING&data=7 $(querystring)) $(urlfetch http://twitch.center/customapi/editquote?token=STRING&data=1 Vote for $(querystring) with !vote1)
~~~

Voting itself looks like this (this would be !vote1, there would be 6 identical commands for 2,3,4,5,6):
~~~
$(urlfetch http://twitch.center/customapi/editquote?token=STRING&data=1%20$(urlfetch http://twitch.center/customapi/quote?token=STRING&data=7&no_id=1)%20-%20$(count)) $(urlfetch http://twitch.center/customapi/addquote?token=STRING&data=$(user) voted for Option 1)
~~~
Wich adds a number behind quote 7 and Places that on quote 1.
It also registers on a AGAIN seperate generated string who voted for what.

I also made a Results command (wich is the reason i sticked with 6 options since it does not fit in the command line)
~~~
$(urlfetch http://twitch.center/customapi/quote?token=STRING&data=1&no_id=1) ♦ $(urlfetch http://twitch.center/customapi/quote?token=STRING&data=2&no_id=1) ♦ $(urlfetch http://twitch.center/customapi/quote?token=STRING&data=3&no_id=1) ♦ $(urlfetch http://twitch.center/customapi/quote?token=STRING&data=4&no_id=1) ♦ $(urlfetch http://twitch.center/customapi/quote?token=STRING&data=5&no_id=1) ♦ $(urlfetch http://twitch.center/customapi/quote?token=STRING&data=6&no_id=1)

~~~

The votelist command
~~~
SUBSCRIBERS ONLY! To see what you can vote for check: twitch.center/customapi/quote/list?token=STRING&no_id=1
~~~

So this system works kinda. But is a hassle to reset. You need to go to Nightbot and reset the counts once your removed something.
and this also allows users to vote 100000 times on one option wich is not ideal.
BUT AT LEAST I TRIED 😂

Lucky Beetle said:
Now i gotta ask. Is there a way to make a Voting system based on your quoting system?

Go to https://twitch.center/customapi/quote/generate. You will see three lines. After token= on the first line, you will see your first token. After token= on the second and third lines, you will see your second token. Use these to replace FIRSTTOKEN and SECONDTOKEN before you add the following commands.

Users vote by typing !vote #, where # is a number between 1 and 6. If a user attempts to cast a second vote, their original vote will be removed. A moderator can change the title of the vote with !votetitle New Title Here or reset the vote to default with !votereset (also resets title). The results are displayed with !results.

!vote (alias to !voteadder)

$(eval try{q=JSON.parse(`$(urlfetch http://twitch.center/customapi/quote/list?token=FIRSTTOKEN&no_id=1)`);`$(urlfetch http://twitch.center/customapi/delquote?token=SECONDTOKEN&clear=1)`}catch(e){q={t:"Title",v:{1:[],2:[],3:[],4:[],5:[],6:[]}}}v=0;for(k in q.v){if(k==`$(query)`){v=k}for(u in q.v[k]){if(q.v[k][u]==`$(user)`){q.v[k].splice(u,1)}}}if(v){q.v[v].push(`$(user)`)}r="?token=SECONDTOKEN&data="+encodeURIComponent(JSON.stringify(q));if(v){r}else{r+"&novote,"+q.t})

!voteadder

$(eval if(`$(urlfetch http://twitch.center/customapi/addquote$(query))`.includes("Successfully added entry")){q=`$(query)`; if ((match = /&novote,(.+)$/.exec(`$(query)`)) != null){match[1] + `: Please enter a valid vote @$(user)`} else{`Your vote was added @$(user)`}}else{`Please use !vote @$(user)`})

!votetitle (alias to !votetitleadder and userlevel moderator)

$(eval try{q=JSON.parse(`$(urlfetch http://twitch.center/customapi/quote/list?token=FIRSTTOKEN&no_id=1)`);`$(urlfetch http://twitch.center/customapi/delquote?token=SECONDTOKEN&clear=1)`}catch(e){q={t:"Title",v:{1:[],2:[],3:[],4:[],5:[],6:[]}}}c=0;if(`$(query)`){q.t=`$(query)`;c=1}r="?token=SECONDTOKEN&data="+encodeURIComponent(JSON.stringify(q));if(!c){r+="&empty"}r)

!votetitleadder (userlevel moderator)

$(eval if (`$(urlfetch http://twitch.center/customapi/addquote$(query))`.includes("Successfully added entry")){if (`$(query)`.endsWith("&empty")){`Please enter a title @$(user)`} else{`The title has been changed @$(user)`}}else{`Please use !votetitle @$(user)`})

!votereset (userlevel moderator)

$(eval `$(urlfetch http://twitch.center/customapi/delquote?token=SECONDTOKEN&clear=1)`; `The votes have been reset @$(user)`)

!results

$(eval v=1; try{q=JSON.parse(`$(urlfetch http://twitch.center/customapi/quote/list?token=FIRSTTOKEN&no_id=1)`)}catch(e){v=0} m=""; if (v){for (k in q.v){if (q.v[k].length>0){m+=" Option "+k+": "+q.v[k].length+" vote"+(q.v[k].length==1?"":"s")+","}}}if(m){"Results for "+q.t+": "+m.substr(0,m.length-1)}else{"No votes have been added"})

Tested and worked! Awesome :P the link u posted for generate had a 1 on the end tho. Is it very complex to add actual names to the options 1-6 (maybe more options)

Lucky Beetle said:
the link u posted for generate had a 1 on the end tho

I don't understand. Can you rephrase this?

Lucky Beetle said:
Is it very complex to add actual names to the options 1-6 (maybe more options)

You should be able to manually edit the default values {t:"Title",v:{1:[],2:[],3:[],4:[],5:[],6:[]}} in !votetitle (run this command immediately after !votereset to initialize the default values).

You can change it like this:

{t:"Title",v:{"Game Title 1":[],"Game Title 2":[],"Game Title 3":[],"Game Title 4":[],"Game Title 5":[],"Game Title 6":[]}}

The voters would have to enter the game titles exactly though. But that's easily fixable if you only intend to use strings as voting options.

I could come up with a command to allow mods to enter the options if that needs to happen often.

Lucky Beetle said:
This would indeed happen often. So that command would be much apreciated 🙂 something like

!voteoption 1 &lt;gamename&gt;

Many of these have changed slightly so you should probably just replace them all. !voteoptions is called like this:

!voteoptions Option 1 | Option 2 | Option 3

!vote (alias to !voteadder)

$(eval try{q=JSON.parse(`$(urlfetch http://twitch.center/customapi/quote/list?token=FIRSTTOKEN&no_id=1)`);`$(urlfetch http://twitch.center/customapi/delquote?token=SECONDTOKEN&clear=1)`}catch(e){q={t:"Title",v:{"Option 1":[]}}}v=0;for(k in q.v)if(k.toUpperCase()==`$(query)`.toUpperCase())v=k;if(v){for(k in q.v)for(u in q.v[k])if(q.v[k][u]==`$(user)`)q.v[k].splice(u,1);q.v[v].push(`$(user)`)}r="?token=SECONDTOKEN&data="+encodeURIComponent(JSON.stringify(q));v?r:(r+"&n"+JSON.stringify(q)))

!voteadder

$(eval if(`$(urlfetch http://twitch.center/customapi/addquote$(query))`.includes("Successfully added entry")){if ((match = /&n(.+)$/.exec(`$(query)`)) != null){q=JSON.parse(match[1]); o=" OPTIONS:"; for (k in q.v){o+=" "+k + ","}q.t + o.substr(0, o.length-1) + ` @$(user)`} else{`Your vote was added @$(user)`}}else{`Please use !vote @$(user)`})

!votetitle (alias to !votetitleadder and userlevel moderator)

$(eval try{q=JSON.parse(`$(urlfetch http://twitch.center/customapi/quote/list?token=FIRSTTOKEN&no_id=1)`);`$(urlfetch http://twitch.center/customapi/delquote?token=SECONDTOKEN&clear=1)`}catch(e){q={v:{"Option 1":[]}}}c=0;if(`$(query)`){q.t=`$(query)`;c=1}r="?token=SECONDTOKEN&data="+encodeURIComponent(JSON.stringify(q));if(!c){r+="&empty"}r)

!votetitleadder (userlevel moderator)

$(eval if (`$(urlfetch http://twitch.center/customapi/addquote$(query))`.includes("Successfully added entry")){if (`$(query)`.endsWith("&empty")){`Please enter a title @$(user)`} else{`The title has been changed @$(user)`}}else{`Please use !votetitle @$(user)`})

!voteoptions (alias to !voteoptionsadder and userlevel moderator)

$(eval try{q=JSON.parse(`$(urlfetch http://twitch.center/customapi/quote/list?token=FIRSTTOKEN&no_id=1)`);`$(urlfetch http://twitch.center/customapi/delquote?token=SECONDTOKEN&clear=1)`}catch(e){q={t:"Title"}}c=0;if(`$(query)`){q.v={};o=`$(query)`.split(/\s*\|\s*/);for(i=0;i<o.length;i++){q.v[o[i]]=[]}c=1}r="?token=SECONDTOKEN&data="+encodeURIComponent(JSON.stringify(q));if(!c){r+="&empty"}r)

!voteoptionsadder (userlevel moderator)

$(eval if (`$(urlfetch http://twitch.center/customapi/addquote$(query))`.includes("Successfully added entry")){if (`$(query)`.endsWith("&empty")){`Please enter the vote options separated by | @$(user)`} else{`The vote options have been changed @$(user)`}}else{`Please use !voteoptions @$(user)`})

!votereset (userlevel moderator)

$(eval `$(urlfetch http://twitch.center/customapi/delquote?token=SECONDTOKEN&clear=1)`; `The votes have been reset @$(user)`)

!results

$(eval v=1; try{q=JSON.parse(`$(urlfetch http://twitch.center/customapi/quote/list?token=FIRSTTOKEN&no_id=1)`)}catch(e){v=0} m=""; if (v){for (k in q.v){if (q.v[k].length>0){m+=" "+k+": "+q.v[k].length+" vote"+(q.v[k].length==1?"":"s")+","}}}if(m){q.t+" RESULTS:"+m.substr(0,m.length-1)}else{"No votes have been added"})

Be careful when adding !vote because it is exactly the character limit for a command.

DUDE! it works perfectly!! :D You cant use spaces in !voteoptions tho. so I need to do "Horizon-Zero-Dawn". Is that normal? if so then no problem ill work with it! :D

Im super happy that this works so wel!!!

You should definatly make a topic about this here so other can implement it too :P Maybe generate an auto installer

Also just a side idea :P is there a way to generate a string of the usernames who already voted? So i can check who still needs to vote incase i want to wait till all my subs have voted.

Lucky Beetle said:
You cant use spaces in !voteoptions tho. so I need to do “Horizon-Zero-Dawn”. Is that normal? if so then no problem ill work with it! 😃

Spaces work fine for me.

Oh? ill try it out then. I might have done something wrong.

Lucky Beetle said:
is there a way to generate a string of the usernames who already voted? So i can check who still needs to vote incase i want to wait till all my subs have voted.

!voted

$(eval m="";c=0;try{q=JSON.parse(`$(urlfetch http://twitch.center/customapi/quote/list?token=FIRSTTOKEN&no_id=1)`); for (k in q.v){for (u in q.v[k]){m += q.v[k][u] + ", ";c++}}}catch(e){} if(m){m.substr(0,m.length-2) + (c==1?" has":" have") + " voted"}else{"Nobody has voted"})

It seems to be removing the vote when somebody votes an unvalid entry.

test.PNG
Lucky Beetle said:
It seems to be removing the vote when somebody votes an unvalid entry.

I think this was due to Nightbot loading the quote pages slowly sometimes. The old commands were removing then readding the vote quote to change it. So when one command attempted to read the votes before another command finished readding them, all the votes would be lost. I modified all the commands to use editquote so this shouldn't be an issue anymore.

Go to https://twitch.center/customapi/quote/generate. You will see three lines. After token= on the first line, you will see your first token. After token= on the second and third lines, you will see your second token. Use these to replace FIRSTTOKEN and SECONDTOKEN before you add the following commands.

!vote (alias to !voteadder)

$(eval try{q=JSON.parse(`$(urlfetch http://twitch.center/customapi/quote/list?token=FIRSTTOKEN&no_id=1)`); v=0;for(k in q.v)if(k.toUpperCase()==`$(query)`.toUpperCase())v=k;if(v){for(k in q.v)for(u in q.v[k])if(q.v[k][u]==`$(user)`)q.v[k].splice(u,1);q.v[v].push(`$(user)`);"?token=SECONDTOKEN&data=1%20"+encodeURIComponent(JSON.stringify(q))}else{(`$(query)`?"?i":"?n")+JSON.stringify(q)}}catch(e){"?u"})

!voteadder

$(eval u=`$(query)`;if(`$(urlfetch http://twitch.center/customapi/editquote$(query))`=="Successfully modified entry #1"){`Your vote was added @$(user)`}else if(/^\?i.+$/.exec(u)!=null){`Invalid vote option @$(user)`}else if((m=/^\?n(.+)$/.exec(u))!=null){q=JSON.parse(m[1]);o=" OPTIONS: ";for(k in q.v){o+=k+", "}q.t+o.substr(0,o.length-2)+` @$(user)`}else if(u=="?u"){"A mod must type !votereset"}else if(u.startsWith("?token=")){"Failed to reach website"}else{`Please use !vote @$(user)`})

!votetitle (alias to !votetitleadder and userlevel moderator)

$(eval try{q=JSON.parse(`$(urlfetch http://twitch.center/customapi/quote/list?token=FIRSTTOKEN&no_id=1)`); if (`$(query)`){q.t=`$(query)`;"?token=SECONDTOKEN&data=1%20"+encodeURIComponent(JSON.stringify(q))}else{"?n"}}catch(e){"?u"})

!votetitleadder (userlevel moderator)

$(eval u=`$(query)`;if(`$(urlfetch http://twitch.center/customapi/editquote$(query))`=="Successfully modified entry #1"){`The vote title has been changed @$(user)`}else if(u=="?n"){`Please enter a title @$(user)`}else if(u=="?u"){"A mod must type !votereset"}else if(u.startsWith("?token=")){"Failed to reach website"}else{`Please use !votetitle @$(user)`})

!voteoptions (alias to !voteoptionsadder and userlevel moderator)

$(eval try{q=JSON.parse(`$(urlfetch http://twitch.center/customapi/quote/list?token=FIRSTTOKEN&no_id=1)`); if (`$(query)`){q.v={};o=`$(query)`.split(/\s*\|\s*/);for(i=0;i<o.length;i++){q.v[o[i]]=[]}"?token=SECONDTOKEN&data=1%20"+encodeURIComponent(JSON.stringify(q))}else{"?n"}}catch(e){"?u"})

!voteoptionsadder (userlevel moderator)

$(eval u=`$(query)`;if(`$(urlfetch http://twitch.center/customapi/editquote$(query))`=="Successfully modified entry #1"){`The vote options have been changed @$(user)`}else if(u=="?n"){`Please enter the vote options separated by | @$(user)`}else if(u=="?u"){"A mod must type !votereset"}else if(u.startsWith("?token=")){"Failed to reach website"}else{`Please use !voteoptions @$(user)`})

!votereset (userlevel moderator)

$(eval `$(urlfetch http://twitch.center/customapi/delquote?token=SECONDTOKEN&clear=1)`; `$(urlfetch http://twitch.center/customapi/addquote?token=SECONDTOKEN&data=$(querystring {"t":"Title","v":{"Option 1":[]}}))`; `The votes have been reset @$(user)`)

!results

$(eval try{q=JSON.parse(`$(urlfetch http://twitch.center/customapi/quote/list?token=FIRSTTOKEN&no_id=1)`); m="";for (k in q.v){if (q.v[k].length>0){m+=" "+k+": "+q.v[k].length+" vote"+(q.v[k].length==1?"":"s")+","}} if(m){q.t+" RESULTS:"+m.substr(0,m.length-1)}else{"No votes have been added"}}catch(e){"A mod must type !votereset"})

!voted

$(eval try{q=JSON.parse(`$(urlfetch http://twitch.center/customapi/quote/list?token=FIRSTTOKEN&no_id=1)`); m="";c=0;for (k in q.v){for (u in q.v[k]){m += q.v[k][u] + ", ";c++}}if(m){m.substr(0,m.length-2) + (c==1?" has":" have") + " voted"}else{"Nobody has voted"}}catch(e){"A mod must type !votereset"})

I wasen't typing it too fast I waited at least 5-10 seconds between commands. I think the problem was that in the Vote command it read the quote line, saved it and then removed the quote line. But if the voteadder replied with "else{Please use !vote @$(user)}" there would be no new quote line made, hence deleting the quote entirely.

Hi! I'm wondering if there is a way to add the game the streamer is playing, what day the quote was said on, and who said the quote, to this quote command? Thanks.

@Misty Snake Change your !addquote to something like this:

$(urlfetch http://twitch.center/customapi/addquote?token=TOKENHERE&data=$(querystring $(time US/Central "M/D/YYYY") $(user): $(query) ($(twitch CHANNELNAMEHERE "{{game}}"))))

Remember to replace TOKENHERE with your token and CHANNELNAMEHERE with the channel.

Does it matter if I'm a mod editing this command, or does the actual streamer need to do this to get the correct token?

I have one more question. When I add the quote, it says "Davis0293:" and then the quote so it looks like whatever quote i'm trying to add, I'm the one that said it. Is there a way to fix that?

that's because of the $(user) variable in his command, you should probably remove that.

when i try to add the edit one i get this, im not sure what it means by this, can someone help?

F532162B-CF86-4B5E-B24A-BEC6DFA83A91.png

After data= in your URL you need to supply an entry index, followed by a space, followed by the new value. Everything after data= also needs to be URL encoded.

For example, to change entry 3 to "my new value":

http://twitch.center/customapi/editquote?token=ca002408d58e1b4d&data=3%20my%20new%20value

I moderate multiple Twitch channels, and I have set up quote systems for a few of them. Tonight, they stopped working, with Nightbot only responding with "[Error Connecting To WebProxy Service]". Is this a temporary outage in the site hosting the quotes, or is this an issue with the individual Nightbot instances for these channels? Or is the API no longer supported? The quote list is still accessible using a link generated before the error started, but using "!quote list" will not generate the link.

This has happened once before, and it came back online within an hour. This time, however, I am unsure. I shot a tweet to nightdev, but it'd seem they take awhile to reply. So, for now, we'll just see what happens in the coming hours.

I use this api for quotes as well, so I'd very much like to see this come back online.

Quick note, there was a time were nighdev was completely down, and I was unable to access the list of quotes. So from one api user to another, make a backup just in case.

I don't really see anything on my end so it may have been Nightbot. Got here too late to properly experience it myself so it's hard to tell.

Hi, This quote system is great, but is there a way to allow me to @ someone in the !quote command without it messing up the search or list feature?

For example I want to be able to put in
"!quote datdudelarkin 3" or "!quote datdudelarkin 1/12 something"

and get "@datdudelarkin (w/e the 3rd quote is)" or "@datdudelarkin (a quote that matches the "1/12 something" search)"

@Ivory Mouse (saw you were quite adequate and helped others, any ideas? I will have too many quotes to just use the 8ball command)
trying to make !quote function as a customized !8ball command however any typing after my !quote command (i.e. "!quote Is the sun hot?") always returns the final quote in the list. is there a way to make this stay random?

Change the command to not take any parameters, by removing the ($querystring) part.

$(urlfetch http://twitch.center/customapi/quote?token=b4954d74&data=)

Thank you so much! working perfectly!

I just discovered this forum, I moderate another channel and had accidentally deleted the !quote command for the channel while trying to edit a quote. I have the url link for the customap quotelist. is there anyway to readd the !quote command? the !addquote and !delquote are still there I just need the !quote command

Crisp Eagle said:
I just discovered this forum, I moderate another channel and had accidentally deleted the !quote command for the channel while trying to edit a quote. I have the url link for the customap quotelist. is there anyway to readd the !quote command? the !addquote and !delquote are still there I just need the !quote command

Just replace YOURTOKENHERE with your token from your quote list and add this command:

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

I try putting it in but it just gives me a link for the command list

Thank you very much!
Is it possible to specify number and total numbers of quotes? For example, I have 10 quotes and the bot return quote #7 from the list, so in chat should be something like this: "[7/10] Another quote blah blah...."

Hi,

I have setted up this quote system quite a while ago and it was working.
When I try now, I get an 500 Server Error.

Were there any changes in usage, is the service just not working at the moment, or is the service retired/deprecated?

Nightbot says: "Remote Server Returned Code 500"

When opening the link in the browser directly: "500 Internal Server Error
The server has either erred or is incapable of performing the requested operation."

Thanks for any hint

I'm also getting the 500 server error. Please let me know if it gets fixed.

I am using this quote system to moderator the songlist for a friend of mine playing guitarhero.

I wonder if there is anyway to remove more than one id with only one command?

At the moment we have a !clear for clearing the whole list and !clearid to clear a specific one.

Sorry for my rusty english.

image.png

Also i have another question. It is probably not possible, but is there in any way you can make the text size going to the weblink bigger in size?

Floral Penguin said:
I am using this quote system to moderator the songlist for a friend of mine playing guitarhero.



I wonder if there is anyway to remove more than one id with only one command?

At the moment we have a !clear for clearing the whole list and !clearid to clear a specific one.

Sorry for my rusty english.

It's not possible to delete more than 1 quote at a time without wiping them all, sadly.
As for your second post about the size of the font, you could adjust the "zoom" in your browser, I think at this point every browser has that somewhere.

image.png

Hello.
I have been reading up in here but seeing how helpful everyone is I kind of wanted to post to make sure I understand some things correctly.

What I want to do is make a !fact command. I want to personally add all the facts, I'm assuming it would have to be one by one, let me know if there is an easier way to add them.

I only want one command that people can type in chat and they will get a random fact.

Do remove the numbering system would I only have to add &no_id=1 in the end of the link? and only for the command that people will use to generate the fact in chat?

I think I would also like to remove the part where they can see all the facts in a list.
Is that possible?

Also I think I would be ok having the !fact "cookie" thing for example.

I would also like to know how the timer thing would work, if I'd want a random fact to come up in chat every so minutes for later use.

How would this be set up in the timers tab in nightbot? Would I just add the interval I want and the alias: !fact ??

I try to establish a management of multistre.am links with this quote-system. Everything works fine, except of editing a specific entry.

There is a problem in $(querystring) in combination with another API, which is generating the links automatically.

#addmulti = $(urlfetch http://twitch.center/customapi/addquote?token=MYTOKEN&data=$(urlfetch https://decapi.me/twitch/multi/$(querystring)))

-> When I type #addmulti stream1 stream2 a new entry is added (https://multistre.am/stream1/stream2/layout4/)

#editmulti = $(urlfetch http://twitch.center/customapi/editquote?token=MYTOKEN&data=$(urlfetch https://decapi.me/twitch/multi/$(querystring)))

-> When I type #editmulti 1 stream1 stream2, I get following message: "You must specify entry index and new value."

So I tried to split the $(querystring) with $(eval) command by studying stackexchange, but I haven't got that working! scripting knowledge too bad :(

-> $(urlfetch http://twitch.center/customapi/editquote?token=MYTOKEN&data="$eval( var str1 = "$(eval var q = "$(querystring)";q.slice(0,q.indexOf("%20")))"; var str2 = "$(urlfetch https://decapi.me/twitch/multi/"$(eval var q = "$(querystring)";q.slice(q.indexOf("%20") + 1))")"; var res = str.1.concat(str2);)")

Could someone help me out to get that working?
Thanks in advance

Rosy Frog said:
I try to establish a management of multistre.am links with this quote-system. Everything works fine, except of editing a specific entry.

Nightbot doesn't support more than 2 levels of variable nesting, so you need to form the multistre<nolink>.am link yourself, rather than using decapi<nolink>.me. Here is code for #editmulti that does this:

text
$(urlfetch http://twitch.center/customapi/editquote?token=MYTOKEN&data$(eval e=encodeURIComponent;m=decodeURIComponent("$(querystring)").match(/^(\d+) (.+)$/);if(m&&((s=m[2].replace(/@/g,"").split(" ").filter(c=>c.length).map(c=>e(c))),s.length)){"="+e(m[1]+" multistre.am/"+s.join("/"))}else{"="}))

I'm a moderator in a server that uses this quote API, and I've run into a sticky situation.

The server moderators have noticed that Nightbot occasionally deletes some of our commands. Today, the !addquote command got deleted.

Since the quote API was installed automatically, the server moderators don't know what the private key is to fix this command. We still have the !delquote and !quote commands, along with the public key.

Is there any way that this issue could be fixed?

Jolly Ant said:
The server moderators have noticed that Nightbot occasionally deletes some of our commands. Today, the !addquote command got deleted.

Nightbot does not automatically delete commands. The broadcaster, a manager for the channel, or a mod is deleting the commands.

Jolly Ant said:
Since the quote API was installed automatically, the server moderators don’t know what the private key is to fix this command. We still have the !delquote and !quote commands, along with the public key.

Is there any way that this issue could be fixed?

Have the broadcaster or a manager go to https://beta.nightbot.tv/commands/custom and select the edit button for the !delquote command. They will see something like this in the Message field: $(urlfetch http://twitch.center/customapi/delquote?token=zg4jdt48497bb8bz&data=$(querystring)) (but with a different token).

They should copy this text, close the edit window, then add a new command. Name this new command !addquote, paste the copied text in the Message field, and change del to add. Click Submit.

The issue has been fixed now. Thanks so much for the help!

Nightbot doesn’t support more than 2 levels of variable nesting, so you need to form the multistre.am link yourself, rather than using decapi.me. Here is code for #editmulti that does this

Works quite well. Thanks a lot 👍

Hey all. I don't know if this is already somewhere in this thread, but I can't seem to find it. I'm using the quote coding to create a queue in my stream, and would like to be able to move a name (or "quote") from one position to another, and can't quite figure out the code to do so. So it would be like !move 1 to 5 ideally moving the quote or user in position 1 to position 5. Any help would be greatly appreciated!

I'm actually using this API to create minigames to entertain viewers when the streamer has moments they can't engage chat. I have been using the editquote function to change values in a list and use it as condition "checks" on whether the game should proceed. Is there a way to remove/not show the resulting statements "Successfully modified entry #X" when Nightbot responds? It ruins the immersion and feels very sloppy. I tried experimenting with slice() but couldn't get it to work properly, so I was wondering if you could give me an example.

I don't think you can stop Nightbot from giving a response whenever you use the customapi, but you can certainly modify its response using $(eval). You can follow this example:

!addcom !examplecommand $(eval blah="$(urlfetch http://twitch.center/customapi/editquote?token=yourTokenHere&data=$(query))";"​")

Setting variable "blah" equal to a string containing $(urlfetch) will call that urlfetch and edit the list. After that, the $(eval) will output the next line. Inside the "​" is a zero-width space. Basically this will make Nightbot appear to output a blank message instead of "Successfully modified entry #X"

I'm having a hard time removing the numbers when i bring it !quote. In nightbot, I add, &no_id=1 and when i use the command, I literally see, "&no_id=1"

Please advise! Thanks again for such a great command

Sparkly Buffalo said:
I’m having a hard time removing the numbers when i bring it !quote. In nightbot, I add, &amp;no_id=1 and when i use the command, I literally see, “&amp;no_id=1”

You are probably putting &no_id=1 after the final parenthesis. It needs to go before the final parenthesis. Example:

text
$(urlfetch http://twitch.center/customapi/quote?token=ajdf8sdp&data=$(querystring)&no_id=1)

how to use str.slice() to silence the Successfully added entry #? tnx~~

Dusty Cow said:
how to use str.slice() to silence the Successfully added entry #?

Instead of

text
$(urlfetch http://twitch.center/customapi/addquote?token=YOURTOKEN&data=$(querystring))

use

text
$(eval `$(urlfetch http://twitch.center/customapi/addquote?token=YOURTOKEN&data=$(querystring))`;" ")

Hello! I was just wondering if I could have some help getting the !editquote command to work. I have tried adding it in my channel as suggested, but when I test it, I always get "Invalid Entry Index" from Nightbot. I'm wondering if it has to do with the way I formatted my quotes, with dates and names, which is different from the default way. Other than that, I have no idea what could be causing it. What I'm adding in is

$(urlfetch http://twitch.center/customapi/editquote?token=MYTOKEN&data=$(querystring))

and my addquote command is

$(urlfetch http://twitch.center/customapi/addquote?token=MYTOKEN&data="$(eval var q = "$(query)"; q.slice(q.indexOf(" ") + 1))" - $(touser), $(time US/Eastern "L"))

Any help would be greatly appreciated!

Scarlet Ram said:
Hello! I was just wondering if I could have some help getting the !editquote command to work

You have to type !editquote ENTRYINDEX NEWVALUE
For example: !editquote 1 New value for first quote

Also, you aren't properly encoding the quote in your addquote command. The quote should be encoded so that if you type special characters like & when using your addquote command, they are treated as data and not as special characters. Here is a fixed version:

text
$(urlfetch http://twitch.center/customapi/addquote?token=MYTOKEN&data=$(eval var q = decodeURIComponent("$(querystring)"); encodeURIComponent("\"" + q.slice(q.indexOf(" ") + 1) + "\" - "))$(querystring $(touser), $(time US/Eastern "L")))

Thank you so much! It all works properly now. Thanks for fixing my addquote as well. I was wondering why special characters broke the quote, but I figured it might be a limitation of the bot. Turns out it was just me not knowing what I was doing. I was wondering if it was possible to keep the format when I do !editquote. What I mean is, I currently have to do this

And I would like to not have to add the whole formatting in every time when I edit a quote, and just edit the part in quotation marks ONLY, not the whole date and everything. It's not that big of a deal if I have to do it manually that way, but I was just curious. Thank you for all of your help!

quote.png
Scarlet Ram said:
I was wondering if it was possible to keep the format when I do !editquote

Yes, but it will require you to make a second command named _!editquote and make !editquote an alias to _!editquote

Here are the commands:

text
!editquote (alias to _!editquote)
$(eval e=encodeURIComponent;m=decodeURIComponent("$(querystring)").match(/^(\d+) (.+)/);m?e(`${e(m[1])} ${e(m[2])}`):"0") $(urlfetch $(eval m=decodeURIComponent("$(querystring)").match(/^(\d+) .+/);m?`http://twitch.center/customapi/quote?token=PUBLICTOKEN&data=${encodeURIComponent(m[1])}&no_id=1`:"0"))
_!editquote
$(urlfetch http://twitch.center/customapi/editquote?token=PRIVATETOKEN&data=$(eval d=decodeURIComponent;if((a=d("$(querystring)").match(/^( ( )+) (.*)/))&&(b=d(a[1]).match(/(\d+) (.+)/))&&(c=a[2].match(/^".*"( (")*)$/)))encodeURIComponent(`${d(b[1])} "${d(b[2])}"${c[1]}`);else"0"))

Thank you so much for all of your help @Ivory Mouse! I appreciate it a ton. I wish I knew all of this a year ago when I started setting up this API. You are very helpful.

If you don't add a number a random quote is shown.

Agile Elephant said:
!quote
This will return a random quote

alright i tried learning this on my own but have had no success. the custom api for recent followers will not work for me keeps popping up saying " The most recent followers are No channel"

@Agile Elephant I've noticed that the negative index causes the last added quote to be listed as either "-1", "0" or the listed number (example 259). Additionally, if we call "!quote" and a string/word and a quote is not found, it only pulls the last quote. Is it possible to either respond with a random quote or "no quote found"?

Example: "!quote curse" is used, however, no quote is found using the word "curse" so it pulls the last quote added.

Is there any way nightbot does not need to send me an answer?

@Dawn Dove You can use $(eval) to make Nightbot send a request to the API but also not output its response like so:

$(eval a='$(urlfetch http://twitch.center/customapi/addquote?token=yourPrivateTokenHere&data=dataInput)';' ')

Creating the variable a will call the $(urlfetch) variable within the $(eval), using the API. Then it'll make Nightbot output a space, which will then make the message blank.

I am using the quote system for my game requests so people do !gamerequest (name of game) and it adds it to the list. My issue is the ! command is not seen to my viewers so i was wondering if there was a way for it to respond with what they added.
Nightbot currently says this: Successfully added entry #4
However it would be cool if it said this: Successfully added entry #4 - Zelda

or whatever. or even a line after that simply said the game name. any thoughts or Ideas.. thank you all

@Groovy Giraffe The response for the command can be:

$(urlfetch http://twitch.center/customapi/addquote?token=...) - $(query)

Nightbot would say "Successfully added entry #X" then say what was added in the $(query) after that.

@Agile Elephant, do you know if the !delquote and !editquote commands are not working at the moment? I just found this thread and added to my channel but those 2 commands are not functioning right.

I have added 4 quotes just fine and they show when I !quote 1 or 3 but when I do !delquote 3 or 1, it says "no matching entry found"

Are you able to help?

I don't know if this is still being responded to but how do you make nightbot say "quote #3" instead of just "3."? Also when I try to say !quote #3 instead of !quote 3 it doesn't recognize that either. It seems to not recognize the # at all. I'm not great with programming so any help would be appreciated

@Jolly Swan In your command response just do something like:

Quote #$(urlfetch http://twitch.center/customapi/...)

Thank you for a quick response! I'm a little confused though, there the "..." is, would that be where I put the # for it to show #3 instead of just 3.?

Jolly Swan said:
when I try to say !quote #3 instead of !quote 3 it doesn’t recognize that either. It seems to not recognize the # at all.

You can use Nightbot's eval variable to strip the # character from the query.

Quote #$(urlfetch http://twitch.center/customapi/quote?token=YOURPUBLICTOKEN&data$(eval "="+encodeURIComponent(decodeURIComponent("$(querystring)").replace(/#/g,""))))

Replace YOURPUBLICTOKEN with the token in your existing !quote command, which you can find here: https://beta.nightbot.tv/commands/custom

@Jolly Swan No. The ... part is just for the rest of the quote custom API link. What this does:

Quote #$(urlfetch http://twitch.center/customapi/...)

It will automatically put a "Quote #" in front of the quote when you use the !quote command.

Oh! ok, thanks so much, my streamer will thank you greatly :D

There is an issue related to your property to connect with opera support that solves all the problem and give you clear access to all the things that you need.

Hi thanks for making this. I am moderating a few Twitch Channels and I have added your quote API to add all the clip commands created for a specific channel to pull a random clip so viewers can have fun without needing to remember all the commands. The commands are listed correctly on the Token and Nighbot pulls the randomclip command correctly so it comes back for example a quote like !rage1 . The issue is I want that quote to actually execute the command into Nighbot now it just pulls it as text without executing the command a user needs to input into the chat the actual !rage1 command to work. This is what I use in the Nightbot command. Can you recommend what needs to be changed to make this work or is it not possible?

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

hey, is there a way to export the quotelist to google spreadshet?

i Have a List running and i would like to know if there is way to make a command like !Upnext===1 on the list .. So Nightbot will post in chat something like Upnext is #1 Name ,,is that possible

@Honest Squid Do you mean you want Nightbot to always output the 1st entry? Or output the 1st entry the 1st time the command is used, the 2nd entry the 2nd time, 3rd the 3rd time, etc?

I want it to always be the first the fist Entry .. u see i have a Listing system .. we play squads .. So we Pick 3 People from the list at a time .. If i could get Nightbot to Reply with the first 1,2,3 Entries in chat .. That would be awesome .. If not i would like nightbot to reply with only #1 entry always

@Honest Squid This is the command response you want then. Replace PUBLIC_TOKEN with your public token (8 characters):

$(urlfetch http://twitch.center/customapi/quote/list?token=PUBLIC_TOKEN&data=1&no_id=1), $(urlfetch http://twitch.center/customapi/quote/list?token=PUBLIC_TOKEN&data=2&no_id=1), $(urlfetch http://twitch.center/customapi/quote/list?token=PUBLIC_TOKEN&data=3&no_id=1)

Thank u very Much , Hope u A bless day

It Working But it is reading Out the Entire List ... Is it possible for it just to read 1-3 Entries ??

@Honest Squid My bad, try this:

$(urlfetch http://twitch.center/customapi/quote?token=publicTokenHere&data=1&no_id=1), $(urlfetch http://twitch.center/customapi/quote?token=publicTokenHere&data=2&no_id=1), $(urlfetch http://twitch.center/customapi/quote?token=publicTokenHere&data=3&no_id=1)

After popular demand, I've added a way to recover your public key using your private key:
https://twitch.center/customapi/quote/recover?token=PRIVATE_KEY_HERE

This is for occasions where you accidentally delete your !quote command, but still have access to either !addquote or !delquote, from which you can extract your private key. As always, makes sure to keep your private key secret.

This is mostly for mods and other people around this forum helping fellow nightbot users. I've gotten quite a lot of requests for manually recovering lost public keys. If someone is trying to recover their quotes, you can quickly point them to this instead.

Cheers.

Iam helping a Streamer with this Quote command, but the !quote List has'nt been added through the Automated install for some reason, can you add it manualy, if so how?

@Humble Koala

I assume you've already got the public and private tokens. If not go here https://twitch.center/customapi/quote/generate Copy down the public token (8 characters long) and private token (16 characters long) and keep them somewhere safe. There are 4 quotes set up below:

!quote which returns a random quote
!addquote which adds a quote to the list (mod-only)
!delquote which removes a quote from the list (mod-only)
!quotelist which gives a link to the quote list

Copy and paste these commands into the chat to create these commands. Feel free to rename the commands however you wish. Be sure to replace publicTokenHere with your public token and privateTokenHere with your private token:

!addcom -cd=5 !quote $(urlfetch http://twitch.center/customapi/quote?token=publicTokenHere&data=$(querystring))
!addcom -ul=mod !addquote $(urlfetch http://twitch.center/customapi/addquote?token=privateTokenHere&data=$(querystring))
!addcom -ul=mod !delquote $(urlfetch http://twitch.center/customapi/delquote?token=privateTokenHere&data=$(querystring))
!addcom -cd=5 !quotelist $(channel)'s quote list: http://twitch.center/customapi/quote/list?token=publicTokenHere

Yes, or i hope at least, the other quote commands work, just not the list,

I test your sugestion, will return i a moment when i have tried it out, thanks for reaching out to Me @Sassy Ram

I am trying to help a streamer I moderate for use this amazing quote API as a song request queue, but not in a normal fashion. The main issue I am running into is being able to display the list in a "prettier" package than what the link provides. Is there anyway to do one of the following:

1. Have the commands build the list in a Google Doc or Sheet (or export the list to one)
2. Have the list be able to be called from the streamers personal website (hosted by Squarespace) in order for it to be formatted there. (I'm not very code savvy; but another moderator is trying to setup a webpage for the streamer on the streamer's website that will call the list so it can be formatted but he receives the error: "Access to XMLHttpRequest at 'https://twitch.center/customapi/quote/list?token=PUBLICTOKENHERE' from origin 'http://localhost' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource." and we are unable to get passed that issue).
3. Customize the way the list page looks when opened by viewers who click on the link provided by !quote list.

Any and all help is appreciated.

I deleted my !addquote and !delquote commands. I have my public token. How do I retrieve my private token? I want to keep adding to my list without starting all over with a new quote list. However, if this is what I have to do, will the other list delete after a while? How long? Thank you.

Is there a way to edit the way the quote is structured?

I'd love to have it where you can write !addquote (user) (message)
so that it responds on the !quote command with #x ("message in quotations") - (user) instead of x. (message)?

It just looks nicer to me and I didn't want to get a second bot for the same function just so it looks the way I wanted it to.

Thanks for taking the time to read this!

@Silver Lobster

Change your responses for !addquote and !quote as follows:

For !addquote: $(urlfetch http://twitch.center...&data=$(querystring) - $(user))
For !quote: #$(urlfetch http://twitch.center...)

It doesn't quite work right for my purposes, as it puts the user who added the command after the - essentially attributing the quote to them. What I'd hoped for was so that the first word after the !addquote command would be treated as the user who said it.

For example !addquote FunnyUser This is funny turning into #1 "This is funny" - FunnyUser. Instead, I get #1. FunnyUser This is funny - NomNomFighter.

Since only Mods can add quotes on my channel, a lot of quotes would be attributed to the wrong Users. Is there a way to change that?

@Silver Lobster

If the usage for !addquote is:

!addquote [person who said quote] [quote]

Then adjust the response for !addquote like so:

$(urlfetch http://twitch.center...&data=$(eval a=decodeURIComponent(`$(querystring)`).split(` `);b=a.shift();a.join(` `)+` `+b))

@Sassy Ram Okay, that works! Is there a way to always put the message into quotes and setting a - infront of the username? Then it would be perfect!

Thank you so much already!

@Silver Lobster

This should do the trick. Change !addquote to:

$(urlfetch http://twitch.center...&data=$(eval a=decodeURIComponent(`$(querystring)`).split(` `);b=a.shift();`"`+a.join(` `).replace(/"/g,``)+`" - `+b))

@Sassy Ram THANK YOU SO MUCH! This is exactly what I wanted!

Hi guys, I'm a moderator for a few channels and I wanted to utilize the quote system but as a clip system. With that said, when i add the clip it says something went wrong, we couldnt find the clip. Am i doing something wrong? the commands work, I can add, del and call. However it shows that message.

Capture.JPG

Hey I am currently adding this to a channel I mod, I was wondering are you able to see the full list of quotes?

@Scruffy Rabbit

This is the link you can use to view the list in your browser:

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

Replace PUBLIC_TOKEN with your public token (8 characters long)

Otherwise you can view the list in a command response with this:

$(eval `$(urlfetch json http://twitch.center/customapi/quote/list?token=PUBLIC_TOKEN)`.slice(0,400))

Is there anyway to get this to work in youtube gaming live chat?

Hi I am having the following issue:
Dirty1ou: !quote
Nightbot: Remote Server Returned Code 503

I have added approx. 15 or so quotes and wanted to test it out and am now getting this message 503. The 503 is being given for !quote and !quote list !delquote !addquote

Having the same issue this morning as well. Perhaps just an error with the server?

It is indeed on my end, looking into it.

Hey,

after being able to make the command output result to my liking I found out the delete command does not actually clear them neither does the version with clear=1, the channel name is bloodyhs

@Able Dolphin

Are you sure you set up the command response for your delete command correctly? It should look like this:

$(urlfetch https://twitch.center/customapi/delquote?token=PRIVATE_TOKEN&clear=1)

PRIVATE_TOKEN is replaced with your private token, which should be some jumble of letters and numbers that is 16 characters long.

Anyone else getting an error 500 when trying to add a new quote?

double checked, yes, it may however be a different token on addquote and delquote/purge, could that be an issue?

You can use this tool developed by ehsankia to check what public token is paired with your private token:

https://twitch.center/customapi/quote/recover?token=PRIVATE_TOKEN

Replace PRIVATE_TOKEN with your private token (16 characters long).

Thanks for the check tool, I was indeed adding with a different token than trying to delete, remade all 3 commands and it all works good now :)

what i need to do for personal quotes for each user in my channel? (generate a personal token when its used for first time), its possible?, and how?

@Mauve Cow

No need to generate new tokens. If you want to add someone's name to a quote, just do something like this:

!addquote [some quote] - [name of whoever said the quote]

Hi, I've been asked to create a command in a channel which uses this quote API.

The command in question inserts a random quote from that channel's quote list in the middle of a name provided, as though it were using the quote as a nickname. For example, if a user types:
!aka John Smith
Nightbot would return:
John "[quote]" Smith

I've tried to test a version of this in my own channel, but did so using the token of the channel I'm creating it for, which I assume is the reason it has not worked; on first use, it returned, "[other channel] is not defined" and on every subsequent use it returned, "Right-hand side of 'instanceof' is not an object".

The command is as follows, split for greater legibility:

$(eval
a=decodeURIComponent($(querystring)).split( );
b=a[0]?a.length:0;
c=$(urlfetch https://twitch.center/customapi/quote?token=********&no_id=1 );
d=(a[0] + ' "' + c+ '" ');
while(i=1;i<=(b-1);i++;){
d+=a[i];
}
${d};
)

Is this a valid command, or is there a way I could implement this in this streamer's channel?

@Nimble Badger

!addcom -cd=5 !aka $(eval a=decodeURIComponent(`$(querystring)`).split(` `);if(a.length>1){a.splice(1,0,`$(urlfetch https://twitch.center/customapi/quote?token=********&no_id=1)`);a.join(` `);}else{`Enter at least a first and last name!`;})
Sassy Ram said:
```
!addcom -cd=5 !aka $(eval a=decodeURIComponent($(querystring)).split( );if(a.length>1){a.splice(1,0,$(urlfetch https://twitch.center/customapi/quote?token=********&no_id=1));a.join( );}else{Enter at least a first and last name!;})
```

That's wonderful, thank you!
Is there a way to also add in "quotation marks" to the quote being added (without adding space between them and the quote message)? I tried a couple methods that I thought would work, but they all give me an error.

Just put in quotation marks inside the string:

!addcom -cd=5 !aka $(eval a=decodeURIComponent(`$(querystring)`).split(` `);if(a.length>1){a.splice(1,0,`"$(urlfetch https://twitch.center/customapi/quote?token=********&no_id=1)"`);a.join(` `);}else{`Enter at least a first and last name!`;})

That makes sense, I didn't understand what the ` symbol really meant in JS but I've read up and now that makes sense. Thank you again.

I hate to be a bother and I do apologise, but I've added more functionality and have not been able to figure out why this isn't working.

A lot of the quotes in question are added with pretty inconsistent formatting, some have attributions, some have gratuitous quotation marks and some have none. I want to do two things: (1) remove final instances of ' -' and chop off the rest of the quote from that point, and (2) remove all instances of the " character in the quote. Here's what I have:

!addcom !aka $(eval a=decodeURIComponent($(querystring)).split( );b=\$(urlfetch https://twitch.center/customapi/quote?token=********&no_id=1 )\;c=b.lastIndexOf(' -');d='';if(c>0){d=b.substr(0,c);}else{d=b;}d.replace(/"/g, '');if(a.length>1){a.splice(1,0,\"${d}"\);a.join(\ \);}else{\${a}, a.k.a. "${d}"\;})

Anyone's help would be greatly appreciated.

$(eval a=decodeURIComponent(`$(querystring)`).split(` `);b=`$(urlfetch https://twitch.center/customapi/quote?token=********&no_id=1)`.replace(/[“”"]/g,``);c=b.lastIndexOf(` -`);b=c>-1?b.slice(0,c):b;if(a.length>1){a.splice(1,0,`"${b}"`);a.join(` `);}else{a[0]!=``?`${a}, a.k.a. "${b}"`:`Missing input!`;})

Thanks so much! I put this in (with the appropriate token) and I still got "Right-hand side of 'instanceof' is not an object" however.

The command, for reasons I am not sure of yet, must be edited through the dashboard instead of chat.

Out of curiosity, would there be a way to edit the url nested in the b variable based on arguments passed to the command? I am thinking of how to add &data=(final argument) if that final argument is a number. I thought of how I would do this, but could not fit it into the message field as it's too long.

@Nimble Badger

The following setup uses two commands, !aka and aka, with !aka aliased to aka:

!addcom -cd=5 !aka -a=_aka $(eval a=decodeURIComponent(`$(querystring)`).split(` `);b=parseInt(a[a.length-1]).toString();if(b==a[a.length-1]){a.unshift(b);a.pop();}else{a.unshift(`#`);}a.join(` `))
!addcom -cd=5 _aka $(eval try{a=decodeURIComponent(`$(querystring)`).split(`$(1) `)[1].split(` `);b=`$(urlfetch https://twitch.center/customapi/quote?token=********&no_id=1&data=$(1))`;b=b==`No matching entry found`?`$(urlfetch https://twitch.center/customapi/quote?token=********&no_id=1)`:b;b=b.replace(/[“”"]/g,``);c=b.lastIndexOf(` -`);b=c>-1?b.slice(0,c):b;if(a.length>1){a.splice(1,0,`"${b}"`);a.join(` `);}else{`${a}, a.k.a. "${b}"`;}}catch(e){`Missing input!`;})

Usage:
!aka [name] [optional quote list index number]

If the input index number is larger than the quote list size, a nickname will be chosen at random.

Thank you! I tried to test this in my channel and I'm getting the following error report:

The reason for the !editcom was to add a space in between -a=_aka and $(eval in the first command.

aka.PNG

I tried adding the commands both through chat and through the dashboard. !aka can be added through chat, but _aka must be added through the dashboard.

You are incredible. Thank you. Mind if I ask what arguments exactly !aka is passing to _aka here? I may want to create a couple of other aliases for more specific names.

Oh also! I was running a few more test cases and is it possible to get Nightbot to give the error message when !aka is called by itself with no arguments?

I couldn't tell what would need to be changed, sadly.

This is not that big a deal of course, just asking if there's a quick fix!

aka.PNG

You can see what !aka is passing to aka by decoupling them (edit !aka on the dashboard and clear the Alias field) and testing various inputs. This is what !aka is passing to aka:

[1] [2]

If the last argument is an integer, [1] is the last argument, else [1] is the '#' character.

If the last argument is an integer, [2] is the user input excluding the last argument, else [2] is the entire user input.

This response for _aka should have better error handling. Remember to use the dashboard instead of chat:

$(eval d=decodeURIComponent;if(d(`$(2)`)!=`null`){a=d(`$(querystring)`).split(` `);a.shift();b=`$(urlfetch https://twitch.center/customapi/quote?token=********&no_id=1&data=$(1))`;b=b==`No matching entry found`?`$(urlfetch https://twitch.center/customapi/quote?token=********&no_id=1)`:b;b=b.replace(/[“”"]/g,``);c=b.lastIndexOf(` -`);b=c>-1?b.slice(0,c):b;if(a.length>1){a.splice(1,0,`"${b}"`);a.join(` `);}else{`${a}, a.k.a. "${b}"`;}}else{`Missing input!`;})

Oh okay, that actually seems totally obvious to me now, haha.

Thank you so much for all the help!

Hey!

Is there a way to edit the whole quote list more easily? We are at 1000 quotes now and would like to remove some.
The !delquote command gets the quote numbers all changed up (e.g. quote 600 is then quote 599).
The !editquote command is very handy for single quotes, but doing that for all quotes would be tedious.

Is there for example a txt, csv or any file where all the quotes are saved in that you can change from outside, without needing to use the nightbot commands?

Thanks!

I'm trying to implement the !editquote command for a streamer but I don't understand what the "private key" is or how you get an !editquote command leading to a website to edit the quote. I'm new to this but have had no roadblocks with adding commands to nightbot until this one. Could anyone specify?

It's the same as for the addquote/delquote, but instead it's editquote in the URL/command line:

delquote: $(urlfetch https://twitch.center/customapi/delquote?token=TOKEN;data=$(querystring))
editquote: $(urlfetch https://twitch.center/customapi/editquote?token=TOKEN;data=$(querystring))
(tbh, I don't know if &amp has to be after the TOKEN)

The token is a unique string of letters and numbers that only the streamer should know. The token is written in the add/delquote command lines when you first generated the command lines like it says in the original post.

I apologize for being dumb, I've tried multiple times to get it to work but I've had no luck. How exactly should it be typed out? I've tried it as what you said but it just said error.

also what do you mean by &amp?

@Jolly Swan

This is the command response you need to set up for !editquote:

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

Replace PRIVATE_KEY with the private key to your quote list. This should be the 16-character long random string of letters and numbers that allows Nightbot to add/edit/delete quotes. You should already have this key handy if you already have a quote list set up. If you did not set up the quote list yourself, ask the streamer who you moderate for to private message it to you.

Just in case, this is the usage for !editquote:

!editquote [list ID number of the quote] [new quote]

Either write this in chat after Nightbot joined:
!commands add !editquote $(urlfetch http://twitch.center/customapi/editquote?token=[TOKEN]&data=$(querystring))

Or on the nightbot page (beta.nightbot tv/commands/custom) -> press "+Add command" button -> fill in Command = !editquote ; Message = $(urlfetch https://twitch.center/customapi/editquote?token=[TOKEN]&data=$(querystring))

replace [TOKEN] by the private key, like RokettoJanpu said.

Ignore what I said about "&amp". I got that mistakenly by copy+pasting stuff around.

Is there a way to import quotes from another quote system? I currently use Streamlabs Chatbot but would like to move my quotes over to Nightbot.

@Foggy Seal

If your Streamlabs Chatbot is reading off lines from a locally stored file, there is no good way to import your quotes to this quote system other than running the !addquote command for each and every line.

You may be better off storing your quotes as a Pastebin file.

Look at this pastebin file I use for a trivia command. Note the following aspects of the file:

  • The file starts and ends with square brackets []
  • Each trivia fact is bounded by backticks ``
  • The facts are separated by commas.

Go to https://pastebin.com and create a file for a new !quote command that follows the same aspects as detailed above. Once you create it, copy and paste the following command setup into your Nightbot dashboard to create the command. Replace RAW_PASTE_LINK with the raw paste link to your pastebin file (the link looks a bit like https://pastebin.com/raw/fooObarR):

$(eval a=$(urlfetch json RAW_PASTE_LINK);a[Math.floor(Math.random()*a.length)])

can you please help me where should i get this token?

@Chilly Giraffe

Get a public and private token pair at https://twitch.center/customapi/quote/generate

The public token is 8 characters long and the private token is 16 characters long. The public token is located within the first generated link. The private token is located within both the second and third generated links. The tokens are found after token= and before &data=$(querystring) Copy these tokens down and keep them somewhere safe.

is it possible to edit the token site so i dont have to put in each and every quote when im adding a lot

@Urban Ox

If you're familiar with cURL you could write a php script that loops through a list of quotes and makes a GET request to the quote API for each quote.

Example given below:

<?php
// Set up an array of quotes to be added to the quote list
$quotes = ["Hello world!","Sh-boom sh-boom! Oh life could be a dream!","Who toucha my spaghett?!"];
// Initialize cURL
$ch = curl_init();
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "GET");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HEADER, true);
$url = "https://twitch.center/customapi/addquote";
// Loop through the quotes array and add each one to the quote list via cURL
for($i=0; $i<count($quotes); $i++){
$params = array("token" => "PRIVATE_TOKEN", "data" => $quotes[$i]);
curl_setopt($ch, CURLOPT_URL, $url . "?" . http_build_query($params));
curl_exec($ch);
}
// Job's done!
curl_close($ch);
echo "Job's done!";
?>

Can somebody help me please i can not get my win and kill counter to work this is all i need to achieve

Iwins user has 3 amount of wins with 1k 2k 3k

is there a list of the codes you can use on the api site name ? Trying to just pull the quote id without pulling the quote. like noid and clear all***

@Fancy Owl

The quote API allows the following additional parameters.

no_id=1 will return a quote without the ID number in front of the quote:

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

clear=1 will clear all quotes from the list:

$(urlfetch https://twitch.center/customapi/delquote?token=PRIVATE_TOKEN&clear=1)

PUBLIC_TOKEN and PRIVATE_TOKEN are the public token (8 characters long) and private token (16 characters) of the quote list.

oh ok thanks for the response, thought there would be more.

Hey! I mod a Twitch chat and I think one of the other mods manually deleted the !quote command and now we can add and delete quotes but the !quote commands (i.e. !quote 1, !quote 2 etc) do not work... any ideas on how to fix this?

@Swanky Ant

Copy down the private token from your !addquote command (16 characters long). Then go to this URL:

https://twitch.center/customapi/quote/recover?token=PRIVATE_TOKEN

Replace PRIVATE_TOKEN with your private token. This will bring you to a page where you can recreate your !quote command.

Hello! I would like to make it possible to use the command like this: "!quote [Name of a person]". I need this in order to get something like this: "[Name of the writer] shoots at [Name of the person] [random message]. Please tell me, is it possible to do it? Since I always have "0 message" in this situation and not a random message. Thanks in advance, and sorry for my bad english.

@Urban Beetle

Use the following command response. Replace PUBLIC_TOKEN with your quote list public token (8 characters long).

$(user) shoots at $(touser) $(urlfetch https://twitch.center/customapi/quote?token=PUBLIC_TOKEN&no_id=1)

Thank you very much, you are the best! :3

Hi, my friend accidentally editted his !quote command and has lost his Quote token (To receive and display the quotes) is there anyway to get the token back. Whenever he clicks on the "https://twitch.center/customapi/quote/nightbot" link it says "500 internal server error"

@Whimsical Snail

Your friend can enter this link in their browser in order to recreate their !quote command. Replace PRIVATE_TOKEN with their quote list private token (16 characters long, can be found inside the !addquote command):

https://twitch.center/customapi/quote/recover?token=PRIVATE_TOKEN

Hi ehsankia, I was wondering if you would be able to help me make a few changes to the quote system. Example, when I add a new quote I want it to automatically say something before the quote. @Agile Elephant

@Swift Goat

This is easy to do.

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

Replace PRIVATE_TOKEN with your private token (16 characters long) and EXTRA_TEXT with whatever text you want to add in front of the quote you're adding.

How do I find my private token and is that the new URL I’m going to use for !addquote. Also will the text I put there show up in front of every quote? @Sassy Ram

The private token can be found in either your already existing !addquote or !delquote commands. Yes, the text will be put in front of every quote you add, and it will show up whenever the !quote command pulls that quote.

@Sassy Ram ok thanks. I have a few more questions but I’ll get back to you with those in a bit

it isn't working @Sassy Ram

edit: i think i figured out what i did wrong, ill get back to you.

i got it to work, i just have a few more questions.

I don't know if this is possible but is there a way that I can make it so the text before the quote is like: TEXT quote number TEXT "quote"?.

Also is there a way that I can make it so it doesn't say Successfully added entry #3 when i add a quote? Is there a way that I can have custom text when a quote is added? Also the same for deleting a quote.

Thanks.

You can make !addquote say something else. Replace PRIVATE_TOKEN with your private token (16 characters long) and TEXT with your text.

$(eval `$(urlfetch https://twitch.center/customapi/addquote?token=PRIVATE_TOKEN&data=TEXT $(querystring))`;`some custom response...`)

This is to make !quote put TEXT in front of the quote. Replace TEXT with your text and PUBLIC_TOKEN with your public token (8 characters long).

TEXT $(urlfetch https://twitch.center/customapi/quote/list?token=PUBLIC_TOKEN)

what is the difference between the 2? when i add text to !addquote it shows the text in front of the quote when I do !quote.

So there is no way i can have text in front of the quote number?

You can put text in front of the quote number. Literally just put the text in front of the $(urlfetch) in the command response for !quote

But if you put text inside the quote, it will show up BEHIND the quote number. The quote number always appears in front of the actual quote.

ok that all works how i wanted it to. So I am assuming that there is no way to change the text that says Successfully added entry and Successfully deleted entry. If there isn't it is not a big deal.

Thanks

You should edit !addquote to the following to block the "successfully added" response:

$(eval `$(urlfetch https://twitch.center/customapi/addquote?token=PRIVATE_TOKEN&data=TEXT $(querystring))`;`some custom response...`)

And edit !delquote to the following to block the "successfully deleted" response:

$(eval `$(urlfetch https://twitch.center/customapi/delquote?token=PRIVATE_TOKEN&data=$(querystring))`;`some custom response...`)

Is there a way I can make part of the custom message the quote

$(eval `$(urlfetch https://twitch.center/customapi/addquote?token=PRIVATE_TOKEN&data=TEXT $(querystring))`;decodeURIComponent(`$(querystring)`))

so where would I put the rest of the text i want? Also can you do the same thing for the message that comes up when you delete a quote.

Also is it possibe for the quote number to me in the message. Example: Quote 5 has been deleted.

do you want me to just tell you exactly what I want and you can tell me if it is possible.

Yeah, tell me what you want exactly so I can help out.

@Sassy Ram Whenever I add a quote the decodeURIComponent is in the message.

I think this is the right quote API for nightbot since it seems to be one, but I just found a fun bug on a streamer's nightbot quote system - haven't tested it on other streamers yet. I forgot that !quote is how you get random ones, so I put "!quote random", which somehow returns a quote at the index of 0 that corresponds to the latest quote. From there, -1 returns either invalid index message OR returns 0, -2 returns "-1" which returns the quote added right before last (so last - 1, last - 2, last - 3, etc.).

So to show an example based on my tests, here is what I have been experiencing/experimenting with, using example quotes of #7 = "mary", #8 = "steve" as most recent and #1 = "bob" as first, which aren't the quotes on the stream I was watching, but will suffice.

Username: !quote 8
Nightbot: 8. steve

Username: !quote 1
Nightbot: 1. bob

Username: !quote <any string/char that is not contained in a quote, such as random, null, fourtwenty, 2+2, etc. I tested a lot of random things)
Nightbot: 0. steve

Username !quote 0 (or 0.8, or any other decimal number such at 0.24 and 5.6)
Nightbot: 0. steve

Username: !quote -1
Nightbot: 0. steve
OR
Nightbot: No matching entry found

Username: !quote -2
Nightbot: -1. mary

Username: !quote -8
Nightbot: -7. bob

Username: !quote -9
Nightbot: No matching entry found

So basically, something's weird with how invalid indices are being handled. Quotes that contain specified words work as intended and the list command is not showing these magical negative indices.

If this isn't the right API, though the commands listed on this page work, then oh well, at least I tried to bug report lmao

is there any way to add a lot of quotes at once? like on a tab you can add like a hundred quotes at once, because i'm using this as a !randomfact command so i wan't as much facts as possible.

I accidentaly deleted the quote 1 from a channel, and we have 1400 quotes, it's basically impossible to remake the whole list for a single quote.

Is there a way to add a quote as number 1?

My friend's channel seems to be having issues with quotes getting eaten by some strange bug. At random, a quote will be either:
1) Entered as normal
2) Replaced with "$(querystring)
3) Entered as normal, but skipping an entry leaving the one before it as "$(querystring)

After experimentation, it seems completely unaffected by whether the quote contains any quotation marks or any other variable on our end. It seems like some kind of backend issue.

It's possible that old quotes have also been affected by this, as the issue goes as far back as quote #12 (she has 96 entries), but we've yet to actually confirm this.

Give me the public quote list I'll take a look at the logs

Looks like you're sending requests to my server from both Nightbot and StreamElements. You must've added the !addquote command to both. The latter obviously doesn't understand $(querystring), which is why you're ending up with duplicate broken quotes. You need to remove the quote commands from streamelements or replace $(querystring) with the equivalent there.

Any time I try to add a quote, I get the response "[Error: Bad Response Status "403"]". I don't understand what's wrong

I'm using Botisimo, with the syntax replaced to work with Botisimo. Does the API only accept responses from Nightbot?

Someone keeps spamming with Botisimo and getting it ip banned on my server. I can unban it for now but in general, I recommend just using Nightbot for quote system

What would happen if someone used Nightbot to spam the system? Isn't there some sort of precaution to stop user specific attacks instead of entire services? I'm asking genuinely, because I really don't know

nightbot itself has better spam prevention, whereas some other bots don't.

@Agile Elephant Can you help me with something to do with the quote system? Would you be able to send me a message?

Hello

I was wandering if this could be used for jokes too.
Instead of adding the jokes through the chat though, i'd rather have the an external txt file where i save the jokes/quotes and can edit, add, detele them easyer

I expect this woudl use the fetch url function but not sure how to make this work. Do you have any ideas?

Dear forum,

I am personally using your quote system as a counter, but I would love to remove a specific query only once.
But it won't work, is there a variable I could add to make it delete one in stead of giving me the answer "too many matching entries"
Hope to hear from you

Kind regards,
Dennis

@Opal Worm You can specify the list ID of the entry you want to delete.

Dear @Sassy Ram,

Thank you for your reply, the thing is it is not handy.
I want to make it person proof 🙂.
I am using the system you created a year ago ((link expired))
Is there really no other way then delete #id?

Kind regards,
Dennis

slight_smile.png

can you explain

1. what do you mean by "the thing is it is not handy"
2. what do you mean by "make it person proof"
3. what do you propose here? If there are multiple matching entries, but you want to remove a single quote, there's no other way to do it through commands.

Dear @Agile Elephant,

Thank you for responding. I just would like a variable that I can put behind the link to delete one entry point with the name "loss""win" .
For example: $(urlfetch https://twitch.center/customapi/delquote?token=token&data=loss&remove=1)
What I mean by human proof is to make it as simple for the streamer as possible so he does !delloss and 1 loss will be subtracted.
Hope to hear from you.

Kind regards,
Dennis Berkers

Hey, so need help with a specific topic, and if this question was answered already I do apologize couldn't find the answer in a scroll. So, right now I have a total 3 commands for quotes -- the regular !quote, !addquote, and !delquote. I have been using the commands for quite a while and they work great. However, what I'm looking for currently is a way to separate the !quote command itself so that regular users (up to vip) can't do, say, !quote 4 to get the 4th quote while moderators up can. Essentially I'm wanting a way to make sure regular streamgoers have the randomized list whereas mods can pull specific quotes for specific situations. How would I go about accomplishing this? Thank you in advance.

Make a copy of the quote command with a new name and set the level to "VIP" or whatever you need it to be. Then update the original !quote command to not have the data=$(querystring) part at the end, that way it always receives an empty argument.

Hey all! Is there some way to impose a cooldown on the !quote command (with or without a number)? Some folk do it a bit too often, and it clogs up the chat quite a lot. Thanks for any advice 🙂

slight_smile.png
!editcom !quote -cd=[new cooldown in seconds]

Excuse me. Is there a way for me to add a name and remove the @member for example. If I do !addquote @member "whatever quote he says". it brings back the result as zebcy "whatever quote he says"..

Thanks in advance

Hi!

I have a bit of a novice question:
I'm a mod/Editor for a channel using this API and a bunch of the quotes in quote list are showing as $(querystring). What does this mean, why is it happening and how do I fix it please?

Sorry if this has already been answered!

Copy and paste your command response for !addquote (with the 16 character private token excluded).

Hello there.

A streamer I have been watching has been receiving an error code every time we attempt to use the !addquote command when he plays Pokémon games. I was thinking it may be the fact of the accent mark "é" and the character not available to be used or posted? I could just be completely wrong lol.

If there was a previous solution similar to my situation I appreciate it, and apologize for the duplicate discrepancy. Just tryna deduce the problem.

Thank you very much!

Is there a way I can create a different command with the sam system?

I'm already using !quote command, and want to create something similar but using a different command instead.

Thanks for the work!

Hey @Bright Swan!

Of course, just generate new tokens. Use the second link in the original post and copy the public and private tokens you'll get. Look at the field bellow if you don't know where to look for these.

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

Then create command with the new tokens.
For example if you want to fill a list and consult it, use this to add an element to your list:

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

And use this to consult it:

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

Like you would for a normal quote command.

Keep your PRIVATE_TOKEN secret, don't share it anywhere, so to add a command do it from the dashboard, don't use the chat as anyone could monitor it and copy the token, they could then edit your list.

Hi
All the commands work, but when i try to display (!quote 1)
it says "1. 0" instead of "0"

Hey @Elder Octopus!

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?

Hey @Elder Octopus!

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?

@Jaunty Unicorn

Hi,

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

Thanks.

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.

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.

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.

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?

@Marble Snake

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.

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

Hi 🙂 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 🙂

Hey @Clever Ant!

Yes you can! I assume you're using /t/random-requests-command/1534606243874738227#m1534606245686677626 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.

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

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

Hey @Elder Ladybug!

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?

Hey @Fuzzy Dove!

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)

Error-403-Forbidden-1.png

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

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

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

Hey @Dusky Dragon!

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).

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

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

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.

Hey @Scruffy Zebra!

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.

If you've got a really convincing reason why such a thing is crucial for a quote system (beyond it's cool to have) i can add it, but in general I prefer staying away from this being a generic database system because it's not meant to be and people tend to abuse it as such.

tl;dr do server bans wear off?

So, I was trying to set up a quote list as a companion to a different, prior list so that the context behind the quote could be stored so that the context doesn't show up in the list view. However, since I need to backdate the new list entries, I planned on using a filler text and editing my way through the list, so I needed the new one to be the same length as the old one. I tried to do this quickly (not realizing that this is basically a DOS attack) by reloading the fetch url repeatedly in my browser. Unsurprisingly, now I only get 403 errors. Firstly, sorry about that, and secondly, can this be undone, and if so, how?

they don't wear off. DM me your IP and if your story holds up I'll unblock it.

This is a really nice quote system you made. I just had a question.
So I have the !quote command, and when I used it it will give a random quote out of the list of quotes I have. The only problem is I also have a timer on. So that after a certain time the bot will use the command, but so far he only repeats the first quote over and over and not the other ones. If I type !quote myself then there is no issue and it gives a different quote. What do I do?

Hey @Gusty Bee!

Make sure the timer's Message field is empty and that the Alias is set to !quote.

Hi there! I've added ten quotes to my !quote command (which I renamed !bhm). I know they were all added successfully, because the bot told me. But when I use my command, I get, "There are no quotes added." The command I'm using is $(urlfetch https ://twitch.center/customapi/quote?token=[...]&data=$(querystring)). I entered it in Nightbot as a custom command, and I'm trying to trigger it in my Streamlabs chat. What the heck's going on?

aloha, i have a suggestion... hope it's not too much trouble... but i love how u added the negative numbers to call quotes from the end of the list... my suggestion is, to allow editquote to use the negative numbers too and maybe delquote as well ^^

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 😉

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.

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.

$(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);)

Hi there! 😊 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 @Fleet Rabbit!

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 @Magic Goose!

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.

I’m a mod for a friend with a growing quote list. Add and del quote commands work well, but I haven’t found anything in the forum how to add the edit command. Is there some magic that came up in this forum long ago or is the edit command a pipe dream?

I must maintain proper grammar and punctuation in this list. The ocd demands it.

EDIT: Is there a blanket way to edit quotes while a stream is offline?

Hey @Sleepy Sheep!

To create an editquote command it's simple, take your delquote or addquote command, and simply replace the delquote or addquote part with editquote.
And yes, you can edit quotes while the stream is offline, that is you're on Twitch, you can't on YouTube.

Hey Emily, we did the thing but received a ‘No matching entry found’ feedback from the bot.

How do you edit quotes while off stream? I can totally take a red pen and go to town off stream.

Thanks!!

Use !quote list to get the full list of quotes along with their entry numbers. You can use this as a reference to edit the quotes.
To use !editquote you need to specify the entry number first and then the updated text, so let's say you want to update the 5th quote, you'd do it like this: !editquote 5 some updated text

Hey @Crisp Whale!

It is not, but that would be an interesting feature.

Hey! I am using StreamElements for this amazing quotes system.

I am having only 1 issue with it. I can get the general code to work for addquote/delquote and for quote to show a random quote in the list. But I cannot workout for the life of me how to do !quote 75 and it tell me quote 75. I have tried numerous things from other comments here, but not any of them worked. Wondered if you have any information?

Thanks, Kimmy

Hey @Groovy Kangaroo!

Sorry, but we only offer support on NightDev products on these forums, I suggest looking in the documentation of StreamElements for a replacement of the $(querystring) variable to replace the end of your !quote command, here's the one that works with Nightbot:

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

Just gave your Requests setup a try, and I can't for the life of me figure out why the "_pick" command doesn't seem to work after invoking "pick" to select a quote/request to consider. It's supposed to delete the displayed line when through, right?

Hey @Upbeat Hedgehog!

Have you made sure that _pick is the alias of !pick?

Where can I find a list of the quotes that have been pulled by my mods?

Hey @Bold Owl!

If you added the command with the automatic installation, then just type !quote list in your chat and click on the link.
It's specified in the usage section, please read the guide before asking a question.

I LOVE the tool and was trying to create a pretty html file to show in OBS to the display on the stream.. I got it working for like two seconds and i think i triggered a security setting when i was debugging.... it says access forbidden and that's all i get now. is there a security setting that i may have tripped?

Yes, there's protection against people abusing the system. How often was your html script querying for new entries?

Hey,

I'm tried to use the quote system, but I'm having problems with the !addquote
and !delquote commands. !quote works and responding fine, but the mentioned ones are not responding at all and my quotes are not getting saved.
I'm the owner of the channel where I'm trying to use it and I used auto install.
Here are my commands:

!quote

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

!addquote

$(urlfetch https://twitch.center/customapi/addquote?token=[TOKEN]&data=$(querystring))

!delquote
$(urlfetch https://twitch.center/customapi/delquote?token=[TOKEN]&data=$(querystring))

Thanks for the help,
Pitypangharcos

Hey @Sunny Koala!

I've been thinking about your issue for the last couple days, and I only see one thing that could be the issue.

1. Make sure the PRIVATE_TOKENS are 16 characters long, although they should be as you used the auto-install.
2. Make sure you have the proper userlevel to use the commands:
• You want to keep the !delquote command to a userlevel of moderator at minimum.
• And if you want regular subscribers to be able to add a quote, then set up !addquote's userlevel to subscriber.
→ you can see commands' respective userlevels on the dashboard.

I'd suggest re-installing the commands again if that wasn't the issue.

Hey! I've been using this for a few years now and recently saw there was the 2000 quote limit, I'm approaching the 1000 quote mark and wanted to know if I could future proof having any problems by having that limit increased!
Appreciate the amazing system by the way!

If you do hit the limit, feel free to DM me and I can fix that for you.

Hi, I am currently experiencing the problem that @Breezy Hedgehog mentioned. I was testing a 5/15 sec. refresh, which seems to be way too frequent. How long I have to wait to stop getting the access forbidden message? And what interval can be safe to be querying? I was thinking something like 30 sec., more time could be misleading for the viewers.

Thanks.

Hi everyone!
One of the less experienced moderators of a channel I moderate for managed to overwrite several quote commands on accident. I managed to recover the list of quotes, and generated a new token. I replaced all the commands, however when I use the !delquote and !editquote commands it comes back with the "invalid entry index" reply. The !quote command correctly replies with random quotes from the list, and when I look up the list, it displays all the quotes. Userlevels are set correctly, and I cannot find errors in the command message after doublechecking the command messages with my own channels commands where everything is working. Any idea why the !quote command is working, but the !editquote and !delquote have the error message?
P.S. It did give me a short, 8 character token when I recovered the quote list. Could this be the issue?

!quote, !addquote, !editquote and !delquote are all different commands. You likely only updated the first one and not the others? There's a short 8 character token and a longer private key, and they are linked.

If you send me your short public key, I may be able to DM you your private key to help you fix your commands.

I discovered that after a little more analysis as well, we had the short one but were missing the longer one. I actually just exchanged it for newly generated ones and remade all the quotes (it was only 21), so it's all fully functional again! Thanks for your help!

Hi, I'm currently trying to set up a quote command for my chat, I want the quote itself to be in quotation marks, and to have the date it was added as a command. Is this possible, and how would the command be formatted? Thank you so much!

Hey @Swift Cricket!

One (and the simplest) way to do it is to modify your !addquote command:

$(urlfetch https://twitch.center/customapi/addquote?token=PRIVATE_TOKEN&data="$(querystring)" [$(time TIMEZONE "DD/MM/YYYY")])

All you have to do is replace PRIVATE_TOKEN with yours, TIMEZONE with yours according to the list of available options, and eventually update the order in which you want the date to be stored (currently day/month/year).

Right now, the output of !quote should be: "quote" [date]

Hi! First, just want to say I love this quote bot and so does my channel. We're currently at over 1700 quotes, and I'm hoping I can increase the cap if we hit the 2000.

I've been trying to create a game where my viewers play hangman with quotes from my quote list. Unfortunately, while I was modifying it, I accidentally caused my application to send waaaaaaayyy to many http requests to my quote list page in a short span of time, and got my IP banned with the 403 error. I tried to dm @Agile Elephant, but I don't currently have the option on the forum (maybe because mine is a new account). I have the quote list save locally for my application at the moment, but I'd like to be able to have my app use new quotes in the future (and be able to view them myself). Could I get my IP unblocked?

Hi everyone, I'm running into a bit of an issue. I've had this quote system for a month and at first it worked perfectly. Now whenever someone adds a quote or just types !quote to see one. This message pops up.
" Quotes must be enabled and at least one quote must be added for this feature to work."

The weird part is, it will successfully add the quote, it will successfully give them the quote to see/read but sends this message directly after. Which just floods the chat and is inconvenient. All of my quote commands are set to "everyone" except for the delete feature that's for mods only. Someone please help if you can.

That error message does not come from my API. It's likely some other bot you have that's accidentally listening and replying to the same command. I assume you're not using Nightbot, since it doesn't have a builtin !quote command. I assume whatever bot you're using has its own !quote command which you need to disable. That's beyond the scope of this forum or this thread, I would suggesting contacting the maker of the bot itself.

As an aside, it is not recommended to set your edit/add quote commands to Everyone, since someone could abuse and modify/add a bunch of quotes when you're not around in your chat.

I am using Nightbot and I don't have any other bots installed. Thank you though for getting back to me and sorry for the confusion. :c

Hello!

Is there a way to add multiple quotes at one time?

Hey @Noble Flamingo!

No, this is not possible as of now.

Hi.
I was wondering if anyone can’t help me. I have a command set up for when a viewers spends a certain amount of bits or subs on my stream that I can type it the command and it will come up with a message and an amount of times. but the issue i have is that i need that number to be different for each viewer who spends the required amount needed. Here is an example of the command i have and the message :

$(touser) has been banned and sent to a place OF LOVE AND APPRECIATION $(count) times!!

But as soon as i type the first viewer is says : “Paul has been banned and sent to a place OF LOVE AND APPRECIATION 1 times!!!”
then when i type the second viewers with a different name it says : “Chris has been banned and sent to a place OF LOVE AND APPRECIATION 2 times!!!”

How can i have it that it can show different amounts for each viewers that's name get typed with this command?

I need the $(count) function or similar function to work so that it counts the amount of “times” separately for each viewers who’s name i type in.

Thanks for all your help.

Can i use this api for making points system?

Hey @Brisk Tiger!

Brisk Tiger said:
Can i use this api for making points system?

It's not recommended, it's not the API's intended use, the dev is free to terminate your tokens at their discretion.

Hey @Maple Squid!

I covered this on the forum in the past, it's not recommended and I won't offer further support on this for the reason mentioned above, but here are some links:
/t/help-with-count/1534600299984064634#m1534600303696019506
/t/a-counter-for-an-individual/1534647709128982689#m1534647710978674718
Please use the search bar before asking.

Hi Emily.

Thank you for trying to help. Maybe i am the one that is not explaining it correctly....lol
I am a complete noob when it comes to all this and even with the things you posted i still have no clue how to get it sorted. From someone like me being a noob and not knowing anything about creating API's etc point of view - this is very complicated and not very user friendly.

Have a great day

Hey @Maple Squid!

I understand, though as I said, it's not the intended use of that API, so I stopped providing support for such use.

The command you want to create is fairly advanced, I'm not sure how you'd want us to make it user friendly, when by its very nature it's not something accessible to people who don't know how to write code.

We're just volunteers, we provide help building commands because we enjoy it, there's nothing to earn from this. And NightDev isn't required to provide support for building commands, they just have to make sure the bot works as expected.

That said, the first link I gave you is the perfect fit for you, all you have to do is:
1. edit the second part of the first command (!blame) — that part: "$(user) blames $(touser) [...] blamed for this" — to what you want your text to say before "X–many times"
2. in the alias command (_blame) edit N in ``t=q.split( )[N];` to the value of the position of the $(user)/$(touser) you're counting minus one — if I take the example of sentence you gave earlier N would be equal to 0, so you'd have `t=q.split( )[0];``
3. follow the instructions to add your command.

I can't make this any easier.

Hello! I just added this to my nightbot to make a timer to pull a random quote, and we added a handful of them to the list just to test it out, and it only pulls the same quote every time. Is there a way to fix this?

Hey @Wise Elephant!

Make sure your timer's code, or the timer's alias command's code, is the following:

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

Your PUBLIC_TOKEN is 8 characters long.

Hello. I'm trying to add a condition (with eval) to my quote command (it's gonna be a list of videos) to figure out whether or not a search term was given. If not, I'd like to call quote 0 (-1) by default, which will have some explanation given. I've tried numerous things, but can't quite seem to get it working. I'll post one of my attempts, since they were all pretty similar in the end. I hope you can help me out, thank you!

$(eval
if($(1) == null)
$(urlfetch https://twitch.center/customapi/quote?token=PUBLICTOKEN&data=-1);
else
$(urlfetch https://twitch.center/customapi/quote?token=PUBLICTOKEN&data=$(querystring));
)

Hey @Lucid Leopard!

In your case it's better to use an alias command to determine what to do, since you call the API twice with that command, and ideally we want to limit the amount of calls.

So first we want to see if there's a search term:

!addcom !videos -a=_videos $(eval `$(1)` === 'null' ? '-1' : '$(querystring)';)

Here the command is called !videos and it calls the alias _videos (-a=_videos) with its output, now all we have to do is to create the alias command:

!addcom _videos $(urlfetch https://twitch.center/customapi/quote?token=PUBLICTOKEN&data=$(query))

By the way, the most likely reason why your command was failing is because $(1) == null doesn't work when working with Nightbot, I think that may be because $(1) is converted to a string in some way, and null isn't a string, so you have to make sure both sides of the comparison are strings.

Hello!
I just noticed that the commands are missing on my friend stream. As far as Im aware only he and I have the acces to the nighbot, we have no idea what happened. Is there any chance of recovering it or we are doomed without the token?

Is there a way to give a NAME to a quote? like "!addquote john1 john: Hi, this is quote 1". So when you do "!quote john1" it print that specific quote. I don't know if im making me understand, thanks anyways!

first i wanna say, that they r numbered and u can call them by number... u can also have it search by the words in the quote... if u already know all this and still want the name so it's easier that trying to remember what number each quote is... yes, u can... exactly as u typed it... but i'm guessing u don't want the name to show and only the quote... if that's the case i have to ask, do u wanna name ALL of the quotes or just some of them? (i ask, because i have 2 different solutions, but one would require that u name every quote because the first word of each quote would be missing... or the other requires a separate command for adding named ones and one for non-named ones)

Hi, first of all I want to thank you for answering me. And about what I want to do: my idea was to simply name SOME quotes, like you know when someone really says somethings hilarious or remarkable that CAN'T be just "!quote 2" or something like that, I mean, I just don't like to be like that. I don't mind to have quotes with numbers, the only thing I want is that some important quotes (to me and to the stream) could have names like in the example I made (!quote john1). Sorry if I don't made me understand, english isn't my native language lol

ok, perfect... so to do that, u would keep the !addquote command u have for normal quotes, and then u would need a second one to add the named quotes... and need to modify the !quote command...

this is for the !quote command... don't forget to replace PUBLIC_TOKEN with the token u already have in the !quote command

js
$(eval a=`$(urlfetch https://twitch.center/customapi/quote?token=PUBLIC_TOKEN&data=$(querystring))`;b=a=>{a=a.split(` `);a[1]=``;a=a.join(` `);a=a.replace(` `,` `);return a};a.includes(`@@`)?b(a):a)

this is for the new !addnamedquote command (or whatever u want to name it)... don't forget to replace PRIVATE_TOKEN with the token u already have in the !addquote command... and when u add quotes with this one, make sure u put the name before the quote just like u did in your example

$(urlfetch https://twitch.center/customapi/addquote?token=PRIVATE_TOKEN&data=$(eval a=`$(querystring)`;`@@`+a))

you are the GOAT, thank you so much!

Hey! I've hit that 2000 quote limit, let me know if you can increase it.
Have a good day!

After four years, I finally hit the quote limit. If you could increase it, I'd be super grateful.

I have also recently hit the 2000 quote limit, would love to have this increased please if possible

Hello, I'm having struggle trying to add the !editquote command can someone help me pls ?

all u have to do is copy the addquote one and where it says...
customapi/addquote?token=
just change the add to edit... like this...
customapi/editquote?token=

Is there a link or another way to access the full list of your own added quotes?

Edit: found the answer, it's twitch.center/customapi/quote/list?token= and then your token value.

hey ya'll! i was trying to add the editquote command to my stream and i troubleshot quite a bit and was not able to get it to work, is there anything I can do about that?

it's the exact same as the add or delete command, just copy one of those and where it says "addquote" or "delquote" change it to "editquote"

Been using this quote system for years without issue and I really have to thank you for putting it together and making it available. We love it!
Our twitch stream community just recently hit the 2000 quote limit, if there's any way you could increase it, that'd be great. If not then I'd love to hear more about how I could host my own database. I don't mind going out of my way to host it myself, but I don't even know where to start.
Thanks for everything!

Apologies if this has been asked, but is there a way when searching for a specific quote, it can ping back a message saying "Quote not found" or something of the sort? When I try to search something specific, let's say !quote pizza, it just pings the latest quote if there is no quote with that word found

This is working for me, just make sure that you replace XXXXXXXX with your 8-character public key:

$(eval a=`$(urlfetch https://twitch.center/customapi/quote?token=XXXXXXXX&data=$(querystring))`; a.toLowerCase().includes(`$(querystring)`.toLowerCase())?a:"No quote with $(querystring) found")

It works for both use cases: !quote and !quote someText

hey all

I'm a mod on a twitch channel and have used this quotes command to fetch a random game character.

The command works fine but the problem is that 50% of the time it will fetches the character last added instead of keeping it random. Could there be something wrong with the command or is it just how the api works?

Thank you for your time :)

If you use “!quote list” it will return all the quotes added and you can then search that document using Ctrl-F if that helps?

id like to add a seperate Quote list to a Chat im Mod in, atm we use the normal Quotes as Streamer quotes, and wed like to add Chatquotes in a seperate command, how do i do that?
Thank you

Follow the same steps to set up a manual command but give your command names a different title eg !chatquote rather than just !quote

I tried the auto one and nothing happens just get an error and the manual one doesn't even describe how to add it properly - can we get a better solution?

Heya!! i'm having issues with deleting all quotes?

this is my command
$(urlfetch http://twitch.center/customapi/delquote?token=TOKEN&data=&clear=1)

edit: it returns 'All entries have been deleted' but the quotes still show up when i check the list view.

thanks so much!

Is there any way of being able to load up the list (!quote list) and then adding your quotes in that way if you have a bundle of them?

I was wondering this too, or if there is a way to reference a doc to pull from?

Hi,

I recently wrote a small python script that uses HTTP Methods to fetch the list, clear it, and put it back in place with duplicates removed (i am moderating for a streamer that uses the Quote API) - but it seems that in the middle of my POST requests i got IP banned by the API for sending too many requests - mea culpa for not delaying the requests a fair bit.

Is this temporary or would i actually need to get manually unbanned?

At that rate, your 80% of the way there from starting a HTTP server and reimplementing the quote system via python (do it as a challenge). Using python to control this "extremely narrow database" is outside the normal use case where it wouldn't require programming knowledge.

Is there a way to export the full list of quotes stored?
I am hoping to clean up the list and remove duplicates or errors, but first I have to find them.

You can find the quote list in plain text at (https://twitch.center/customapi/quote/list?token=<PRIV_TOKEN>) if you replace <PRIV_TOKEN> with your 8-character private token

Hello!
We’ve been using your api a lot and we are really enjoying it. I hit the Quote limit and would like for it to be increased but i'm not finding a place to DM you exactly? I sent you a request on twitter too if that was what you meant!

Not sure when it happened, but yesterday our community noticed that one of the quote tokens we used suddenly had its list clear itself and was empty. I didn't see any clear/delete commands for this specific list happen. We were using the token to keep a tally of wins and losses throughout the year. Has there been any issues with the API or website used for the quote system? I have not noticed that any of the other tokens (about 4 other lists) get cleared, so it was odd that it happened only to this one.

Hi there, when I try to use automatic installation I get an error " Application Error

Failed to fetch OAuth2 application."

When using this !quote command $(urlfetch https://twitch.center/customapi/quote?token=[mytoken]c&data=$(querystring)&no_id=1) (\[mytoken\] being the 8 letters and numbers that make my quote list ID) in rapid succession and no query, it will return a random quote the first time but the second time will always return the last added quote.

Is that normal or am I missing something?

Is there a way to mass add quotes? I have a large list from StreamLabs that I would like to Migrate to Nightbot. I was able to export them from SLabs but I cant quite figure out how to import them to this system.
Hopefully it’s just something silly I’m missing xD

Didn't find your answer? The community is on Discord.

Ask on Discord