I’m not sure if this is the correct area to post in, but I have a question I’ve been trying to figure out. I have an application that supports Twitch, but it needs to listen to multiple channels and return commands to the correct client page.
What is the best method to listen for ! commands that are supplied by a list in the application, per channel?
Get all the PRIVMSG commands sent to the #channel-UUID then parse for !commands.
Using the PubSub system, or listening through IRC?
I was referring to IRC. Enlighten me on this PubSub system.
Thank you, that’s what I was planning on but not quite sure. A lot has changed since I built my first bot, and that was only for a single dedicated channel. This new bot won’t be as chatty, and will have to listen on channels it’s invited to only, while forwarding the commands to the correct sockets. I am playing with the TMI.js Twitch Bot base in Node to create it.
This is the PubSub: https://dev.twitch.tv/docs/pubsub/
It “appears” that it might be able to listen in a similar way, but I am a bit confused on it’s capabilities.
Pubsub is for listening to specific events (ie, Cheers, Subs, Commerce, and Whispers), not general chat. Your best option is to use an IRC library, there’s several designed specifically for Twitch for a variety of languages, and just listening to chat seeing if the messages contain your command.
Thanks, yeah. That’s the intention so far. Like said, I found and have been playing with the TMI.js library. Makes it a lot simpler then writing your own bot in C#.
TMI.js is a great start for basic stuff, but unfortunately has fallen far behind on updates for the new features (such as gifted subs). Personally I’ve started using Twitch-js https://github.com/marcandrews/twitch-js for my Node app, very similar to TMI.js but much more up to date. If all you need is reading/responding to chat messages though, they’ll do that job equally well.
Thanks, I’ll take a look at that as well. It’s early enough that I have no problem switching libraries if needed. I have noticed some disconnection issues with TMI.js, despite it already having .ping replies.
This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.