[CustomAPI] Quote system

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

25 Likes
!joinqueue and !queue command help please
Custom Highlight Command?
How to make a command that adds requests to a queue?
Making folders to store videos, in a command
A different kind of song request issue
Is there a quote list?
Custom command with multiple messages
Some NIGHTBOT Commands(How to create them)?
Response Generator
Creating a suggestion command
A Command To Call A Random Command in Nightbot
List for gaming - Nightbot
Some NIGHTBOT Commands(How to create them)?
Is it possible to make an list?
Is it possible to have random !quote generate on timer?
!addquote i'm not sure how this works
Auto-Updating Leaderboard
Help with creating a custom command
Command that writes to a TXT file
!duel command for a youtube stream
Nightbot urlfetch not working!
Specific giveaway/message each X minutes using a list
Append to Command
I have tree new custom commands ideas but need someone to help me figure out how i can write them
Can you have multiple quote systems?
Multiple counters
How to create a Q&A Command?
Pastebin Alternative
Random Clip by a command
Command to display multiple $(count) results
Trying to Create a count command
How to make nightbot more "chatty"
Wins and kill counter
Chat game a la 'Hot Potato'
Specific giveaway/message each X minutes using a list
After Stream Command
!wins Command with Kill Counter
Wins and Kills comand separate
New To Using NightBot 2018
Constant variable for multiple commands
!thanos command help
Adding a variable to a urlfetch
Create a Note Storing Command
IF/ELSE statement not working properly
Casino guesses!
I creating vote system
Help with $(count)
Success vs Number of Attempts Tracker
Can someone help me to create a custom command
New Sub Counter
New Problem with This
Does anyone know how to make a quote command?
I'm having issues with quotes on my Nightbot
User Command Cooldowns
Let the commmunity send me their levels
I want to make an addition function by applying function $(count)
I want to make an addition function by applying function $(count)
How could I create/modify a global / static parameter in Nightbot?
Custom $(count) reset command for word count / emote count
Global variable
User input reminder
Individual tracking and how to add a point to a user
Calling The Query From Another Command
Adding a command that adds the amount specified to a counter
Help me create a custom command
Help me create a custom command
Command to count how many times command was used for current viewer
Can someone give me the script for adding?
Is it possible to make a Custom Modifiable List Command?
How to make a list
Is it possible to set permanent variables to call up later?
Create a counting command
Custom command for send steam keys in chat
Show command count, without restricting ul
Add a counter (I'm confused about the instruction)
Nightbot - How to setup Death command & How it works?
Add a command to let everyone add another command
Commands being mod only
Count Number of wins
Calling a count and editing it--for Regulars or Everyone?
Counter of another command
Disc Wars aka !duel command in Twitch Chat
Advanced command help (countup based)
Is there a mechanism for session variables in eval?
Is there a mechanism for session variables in eval?
Quote List for NightBot
Quote List for NightBot
List of guesses from users?
Response generator not working
Make a command out of other commands input
Monitor time since last command
Reference a command/variable within an evaluation
Help looking for command
How to make an Eval command without character limit?
Save Users that use Tag to List
List + editlist command
Help with creating a custom command
How do you make a queue demand in Nightbot? (for twitch)
Calling 2 Counts - Updated?
!predict (HELP ASAP)
Is there an existing API for saving key-value pairs
Timestamp or clip it command
Assistance with custom command
Nightbot Command with Multiple Random Outputs
A random option
Can you make a command dynamically call another command?
Help me make this command
Creating a live google document for game requests
Getting a STRING from command?
Looking for command help
Creating commands involving modified lists
Reader Badge Bug?
How to add Nintendo 3DS Friendcodes?
Randomising reply on single command
Mario Maker Level Queues
why does urlfetch remove the spaces when calling the quotes api?
I am having trouble adding a tongue twister command for nightbot
Shiny pokemon counter + name
Shiny pokemon counter + name
All quotes have disappeared
About the command I want to use
Nightbot API - Can nightbot commands send data to a database
Using Nighbot to run a simple Auction
Create Q&A for Youtube
Looking to make a "Days since X" command that can also be reset to zero
Nightbot Analytics
User Specific Counting
A command-driven counter (deaths, w/d/l, etc.) that can be displayed on an overlay
Quote command based on the current game?
Can nightbot hold messages and show them when asked?
Saving query information
Recover specific info from deleted command
Amongus death tracker
Is there a way to create a !command to add chat recs to a public list?
Creating a command to pull specific information from a URL
Can I collect the questions?
How to have commands form a list
Help with “tracker” command
2 different counters in one command
Unique Entries Per User
Command for "days without fuckups"
Count wins and losses for specific servers
Trying to create a "count" command with custom inputs
Count command shaenanigans
Limit Nightbot Command Usage per Day
Vote System Help
I want to make tracker for command
Random Requests Command
Returning value from Google Sheets
I want to make tracker for command
I would like to make a command that adds an item onto a list of items
I would like to make a command that adds an item onto a list of items
HELP - Comparing input to a random number, generating output based on the difference
Nightbot Counter
Looking for a prediction command
Gulag Counter Command
Help create new command
Daily and Weekly $(count) in the same command
Submit words through Nightbot
Win-Loss / Death-Kill Counters in one command
Using the content of one command in another

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!

3 Likes

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”

1 Like

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.

2 Likes

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!

1 Like

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)

2 Likes

This is perfect. Thank you!

1 Like

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

1 Like

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

2 Likes

Thank you so much, just one more thing, the same problem is with !quote list --> http://twitch.center/customapi/quote/list?token=23a39153 There is the same respond with code 500

1 Like

Good catch once again. Fixed.

2 Likes

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

1 Like

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

1 Like

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:


If you have any questions, as how to set it up, feel free to ask.

1 Like

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?

1 Like

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?

1 Like

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.

So, i should put something like:
$(urlfetch http://twitch.center/customapi/quote?token=TOKEN)

Is that right?

1 Like

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

1 Like