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

Wow, this is an incredibly detailed response. I will be sure to try it once I get home from work today, just to verify that it does everything I need it to.

Thank you so very much :slight_smile:

That’s a fantastic use of my quote system!

Just wanted to add a small detail, if all you care about is the list, you can simply do:

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

Otherwise, fantastic job @Aaron128l in cleverly using the API and explaining cleanly.

1 Like

So, I’m running into a few issues here so far.

I am using @ehsankia’s method of it just printing to a separate page, as that will make it easier for me to manage. However, when I do that, it doesn’t seem to be marking the time and date of the highlight.

Additionally, I am pulling the uptime of the stream rather than the actual time of the highlight, because that makes it much easier to work with in Sony Vegas, so keep that in mind.
So, overall, I just want it to, on the call of the !list command, give me the page of timestamps/descriptions, but I can’t figure out how to do that.

Also, for the delete command, which I am using the call of !del for, would it be possible to delete all of them at once, perhaps making it so !del * deletes all the highlights?

Again, thanks a lot in advance for your help with this.

Warm regards,
Jessica

I’m going to break this up into parts in order.

it doesn’t seem to be marking the time and date of the highlight

The !list command is simply making it easier to access the page that !highlight list gives. Their the exact same command. Both of the commands are used to access the list link and not used to add/del highlights.

If the page your going to isn’t correctly formatted in terms of the information your looking for, then it’s probably an error in one of the adding commands somewhere. Probably in the !addhighlight command, as that command single-handedly handles all the formatting of data.

uptime of the stream rather than the actual time of the highlight

If you want to change the date/time aspect of the command it’s as ‘simple’ as changing the formatting of the !addhighlight. Try out this example:

!commands add !addhighlight -ul=moderator -a=__highlightadd_ [$(twitch $(channel) "{{uptimeAt}}")] [ $(query) ]

You have two options here, {{uptimeAt}} or {{uptimeLength}}.
From the docs site about $(twitch):
uptimeAt - date/time user went live (or started playing a playlist)
uptimeLength - length of time user has been live (or started playing a playlist) (years, months, days, hours, minutes, seconds)

Personal personal preference on what ever one you need.

!list command, give me the page of timestamps/descriptions

The command that @ehsankia posted offers that link to the page of all the highlights, make sure the the TOKEN is correct for quote? as they all are not all identical.

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

making it so !del * deletes all the highlights?

I’m not the maker of the API, however I’m sure @ehsankia could probably work that out when he’s free. Until then it’s one by one :confused: which may be useful for keeping track of them.

I did consider adding a clear all at some point, I guess it makes a lot of sense in a scenario like this.

I added a new parameter for delquote. You simply have to add &clear=1 at the end of the command.

I highly recommend setting it to Owner only, as anyone accidentally running that would delete all your entries.

It would look something like so:

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

Make sure to replace the token with the delete token, and again, set the access level properly.

Got it working perfectly now. Thank you very much for your help, both Aaron and @ehsankia, I really appreciate it.

Very warm regards,

Jessica

Actually, one more question before I’m done with this.

Would it be possible for me to make it so when someone does !highlight, it logs their command, but doesn’t respond in chat? I don’t want the chat to be super spammed up with commands.

Thanks in advance,

Jessica

Nightbot doesn’t offer any sort of silent command response. The chat response is more of a confirmation message if anything. You can make all the commands owner access level if you wish to restrict the users who can access this. I don’t see an issue for “super spammed up” as it’s only one command to add a highlight.

Hey, reviving this because I have another question.

Is it possible to make the list of highlights have both the uptime of the stream, as well as the date of the highlight request? Just the date, not the time / timezone. That way, in case there are multiple days in which highlights build up, I can easily differentiate?

I am thinking some combo of uptimeLength and uptimeAt but can’t seem to figure out how to get them to play nice.

Thanks in advance,

Jessica

Try this:
!commands add !addhighlight -ul=moderator -a=__highlightadd_ [$(time America/Denver "MMMM D")] [$(twitch $(channel) "{{uptimeLength}}")] [ $(query) ]

Should output [Date] [Uptime] [comment]

This doesn’t seem to be logging to the list.

I’m a bit unsure of what the problem is. Any help @Aaron128l could provide would also be appreciated.

This seems to work great fine for me. Check that the command has the alias of __highlightadd_ correctly and that you have the __highlightadd_ command. Spacing is also important, double check everything.

Ah, looks like it was an issue with spacing. Thanks so very much for the help to all of you, I see to have it working just as I desired.

Maybe because it’s 3:30 am and I’m sick but I’m not understanding this. From scratch, in the america/chicago timezone, with the TOKEN part marked, what would the formatting be for it so I can have a mod say !highlight and have it output to the file with [date] [stream uptime] [comment] and then the other commands being an owner only command for deleting all on the list and the command to pull up the list? Preferably something I can copy and paste to make sure the syntax is right because I’m not understanding a lot of this code.

There is a fair bit of command magic involved in this one. Here is a generic run down of each command.

  • !addhighlight - Alias of __highlightadd_ that gets the date, stream uptime and comment or anything you want into it. This is the main command that gets all the information.

  • __highlightadd_ - This command is simple. Take everything from !addhighlight and throw it into the end of a Custom API link. The Custom API will add it as a quote.

  • !list or !highlight list is just a link to a list.

This just a generally understanding of it. The more in-depth portion is in the original post with tidbits of useful things added in the later ones.

Thanks, I guess, but that isn’t what I was asking for. At this point the more I look at this the less sense it makes. I just wanted to have someone type it out so I could copy and paste it in to make it work. This only makes it harder to understand for me.

Everything is already arranged in such a way where you can copy and paste it. All you need to do is replace the TOKEN with the actual value you receive from https://twitch.center/customapi/quote/generate There isn’t really a way to simplify it as its already a complex nature.

What I mean is there’s the first part of the thread with the things you can copy and paste, but then other stuff gets added on as the thread goes on and the more I look at it the more confusing it gets as to where to put the additional stuff, and if there were one line for each of the commands I need that I can use to make the commands instead of it being in sections without much instruction on how to piece it together, that would be what I could use. Maybe I should just come back when I’m not sick and sleep deprived. Not like there’s a time limit on it since I don’t even stream yet (computer not up to it yet) anyway. I’m just trying to get the stream to have the features I want before I start streaming eventually.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.