Custom Highlight Command?

Hello, I am looking to create a highlight command that will do the following.

Number them, counting upwards (I can just use the $(count) function for this bit), and mark the date as well as the time.
I would also like it to capture the latter part of the message, after the command call, so it would add a description so I can better sift through what is valuable and what is just a waste of time.

I would then like it to gather all the highlight requests, and put them in order, returning when using a !list command call or something similar.
So, it would print out as follows:

User: !highlight He died.
Nightbot: (3)[April 6 | 05:20][He died.]

Then, once there are various highlight requests, I could call the !list command and it would return something like this:

User: !list
Nightbot: [1][April 6 | 05:00][He died.][2][April 6 | 05:15][He lived.] [3][April 6 | 05:20][He died.]

I have no idea how to do any of this, outside of the $(count) function to number each highlight, but I assume it is possible.

Thank you very much in advance to anyone who is willing to help with this. I greatly appreciate it.

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.