NightDev Community Forums

[CustomAPI] Quote system


#1

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.

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.

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

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.


!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
Custom command with multiple messages
Some NIGHTBOT Commands(How to create them)?
Creating a suggestion command
List for gaming - Nightbot
Is there a quote list?
A Command To Call A Random Command in Nightbot
Some NIGHTBOT Commands(How to create them)?
Nightbot urlfetch not working!
Response Generator
Specific giveaway/message each X minutes using a list
Random Clip by a command
Trying to Create a count command
How to make nightbot more "chatty"
Specific giveaway/message each X minutes using a list
New To Using NightBot 2018
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
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
!addquote i'm not sure how this works
Nightbot Command with Multiple Random Outputs
A random option
Can you make a command dynamically call another command?
Mario Maker Level Queues
Help me make this command
Creating a live google document for game requests
Add a counter (I'm confused about the instruction)
I have tree new custom commands ideas but need someone to help me figure out how i can write them
Looking for command help
Creating commands involving modified lists
Reader Badge Bug?
Is it possible to make an list?
How to add Nintendo 3DS Friendcodes?
Randomising reply on single command
Getting a STRING from command?
Wins and Kills comand separate
Nightbot - How to setup Death command & How it works?
Add a command to let everyone add another command
!wins Command with Kill Counter
Commands being mod only
Count Number of wins
!thanos command help
Command to display multiple $(count) results
Command that writes to a TXT file
Calling a count and editing it--for Regulars or Everyone?
Constant variable for multiple commands
Counter of another command
Disc Wars aka !duel command in Twitch Chat
!duel command for a youtube stream
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
#2

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

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”


#4

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.


#5

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!


#6

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)


#7

This is perfect. Thank you!


#8

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:


#9

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


#10

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


#11

Good catch once again. Fixed.


#12

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


#13

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


#14

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.


#15

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?


#16

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.


#17

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


#18

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.


#19

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

Is that right?


#20

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