Custom Highlight Command?

A week ago or so this wouldn’t be possible. However thanks to @ehsankia and his amazing Custom Quote API, I think we can actually accomplish this.

First (kinda)… Read about that Custom Quote API as that is a big factor in this. All we are doing is using this system in order to create a highlight array rather than a quote list. Cool, right?

We need to get tokens for our system to access only our stuff we can do that by heading to: https://twitch.center/customapi/quote/generate

Take notes of the 3 commands and their use. quote? is for accessing quotes, addquote? is for adding quotes, and delquote? for removing quotes.

We’re going to break this into parts. Adding a Hightlight, Finding a Highlight, Removing Highlight

Adding Highlight

We need a command that will add a highlight(quote) to the system with: Count, Date, Time and a String.

Lucky for us that the Count is already added into the quote system!

Due to how Nightbot passes data in alias in such we have to create a secondary command just handle the adding of Date, Time and String all at once.

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

You have to replace TOKEN with the token for addquote? from the link you accessed earlier.

Now for the adding of everything.

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

Here you can change America/Denver (my timezone) to any zone accepted at https://docs.nightbot.tv/commands/variables/time

And thats all we need for adding commands.

Any Moderator: !addhighlight Look at his arm!
Nightbot: Successfully added quote #1

Reading Highlights!

This is the easy part.

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

Again replace TOKEN with the one listed on the list you generated with the link, the one related to quote?.

You can search with this by using an ID #, a search term, or a list of all of them through a link.

Any Mod: !highlight 1
Any Mod: !highlight Arm
Nightbot: 1. [April 4 | 03:08 am] [ Look at his Arm! ]

Any Mod: !highlight list
Nightbot: http://twitch.center/customapi/quote/list?token=6e2aaf27

Deleting Highlights

To delete a highlight, use the ID # or a search term again.

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

Replacing TOKEN again for the delquote? equivalent.

And there you go! A four command highlight system. Thanks to @ehsankia for doing most of the brute work in making the API.

5 Likes