Twitch IRC bot scalability

Hey. I am doing a hobby project in which I am writing a service to join some channels as a chatbot on twitch. What I want to do is have two standalone services join several channels but not overlap. Example, if service A has joined a channel service B should not join that channel and move on. My problem is, how do I know if a service has already joined a channel without joining a channel.

The services know what channels they’re in. Make them share their lists with each other.

If you use the undocumented Chatters endpoint it’ll give you a list of users in chat on that channel. So what you could do if you’re using a user account to connect with, rather than justinfan,

Keep in mind though that the API is cached, so once you join a channel it could be several minutes before it is updated, this means if you’ll still have trouble if your multiple services are all trying to join get the userlists and join channels at the same time.

There are also many server-side options that could work that could avoid the need to check the channel for the presence of another of your services, such as sharing their list of connected channels between eachother, or getting the list of channels and splitting them between the services before they start connecting. A server-side option would be more ideal as it means not having to make any API requests, and the services could be designed with overlapping not being an issue in the first place.

The problem with the endpoint: is that it’s not very reliable. And, it’s cached which is another issue. I was wondering if there was any other way apart from sharing a list of connected users.

Sharing a list is the best option

When you successfully join a channel, you’ll receive a message like this:

:rokuhodo_! JOIN #rokubotto

Where in this case, rokuhodo_ has joined rokubotto's stream chat.

Like everyone else is suggesting, the best option in my opinion is to just maintain a list of channels each client has joined and cross reference the lists to make sure they each only join unique channels.

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