Search code examples
javascripturlyoutubeyoutube-apicounter

Could Nightbot count the user's particular chat?


Context

I'd like to get and print the number of people's saying, say, 'checkup'. But Nightbot(Youtube, Twitch Chat Manager) don't serve individuals' counter.

The result that I want to get

If a user say !checkupcount, they get the number of calling it.

Problems

  1. Nightbot has the command for counter, which is count, but it is universal.
  2. Also, the counter cannot be edited or removed.

Solutions that I figured out but I can't do:

  • Nightbot is compatible with JavaScript and can use remote URLs
  1. So, I thought I can use Google Spreadsheet for storing data(counting number) and modify the data in it every time a user say 'specific word'.
  2. Then, if a user say 'checkup' it should modify the data in spreadsheet.
  3. And, I just need a command in chatbox for returning the data from the spreadsheet and printing it on chatting.

But, with this solution I need one more thing.

  1. There should be another variable for registering user's name on the sheet.
  2. Fortunately, there's a command for printing user's name in Nightbot which is 'touser'.
  3. But unfortunately, 'touser' only works for printing, and I don't know how it works internally. If I can get a value from 'touser', it should be possible for modifying data in Google Spreadsheet.

It is first time to ask in here, so I'm worrying about kind of being rude for those who answer (because I didn't give any help to others...). But if possible, I'll try to help other people, w.r.t. figuring out some solution that doesn't need professional coding skill.


Solution

  • With nightbot only, I don't think it's possible to do what you request. I think, though, that you could obtain the expected behavior by creating yourself a custom app using nightbot's api.

    You could implement a new way of creation of commands, in example implementing a method that will handle two POST requests: one to a db containing a data structure that will hold your ID-Integer couple and the other one to the nightbot api; this is a link to the nightbot api to show you how to set up this request.

    Of course, you'll need to handle the call to those commands and, in the same way, you can handle a POST request to retrieve the data from the db and another one to send a message to the chat of your channel, of which you can see an example here.

    P.s. In order for you to get a better experience on so, I suggest you to read this FAQ