Architecture for Bot Servicing Many Twitch Accounts

I am working on an application that will have a Server that the user authenticates via Twitch on. Once they signup, I would like them to have the ability to turn on our bot and use it in their channel.

Looking at the docs and researching Nightbot (and others), I have not settled on an architecture that I feel comfortable with. The docs mention tmi.js, but it seems I would need to run a process per a streamer. Is there another option I could use? Possibly harnessing websockets?

Any insights or ideas would be appreciated! Thanks!

If you are running a multi channel bot, that works “like” nightbot. Nightbot uses one Twitch account and only needs one process per x number of channels. Adjust x to mean you usage requirements as per Twitch’s Rate limits.

If like your post title suggests you want to service multiple channels where the bot has a different name in each channel Servicing Many Twitch Accounts then you’d need to run one process where bot account name.

TLDR:

  • One Process per x channels if bot is called MyBot
  • One Process per bot name if the bot has a different name on each channel

TMI over WebSockets works the same as TMI over IRC.

TMI = Twitch Messaging Interface.

tmi.js just shares the name.

1 Like

Multi-channel bots tend to use one process for communicating with Twitch chat, usually using a well-established IRC library, sometimes implementing just the necessary parts themselves. Processing the messages often also happens in that same process (single-process bots), but there are some utilizing a microservice architecture with different parts/types of processing split into separate services.

Thanks for the response! I was mistakenly looking at the docs in the manner that I needed to use the Twitch user’s authentication credentials to interface with chat (instead of an IRC user that can be a part of multiple channels).

For sanity -

Once the bot is authenticated, the Twitch user can add the bot to their chat (my server calling JOIN) and if they want to turn it off, remove them from chat (using PART command).

Thanks again!

An IRC user is a Twitch user…

errr close enough

Yep, I know it is a Twitch user now. I was saying I didn’t think to correlate them 1:1 when I was first researching it. :man_facepalming:

Is there something big I am missing? Or just that I am excluding granular details?

For the most part yes it’s join to join and part to part

But when you part/leave do you need to consider auto deletion of stored commands and/or access keys and/or any chat logs etc, ala GDPR-esque considerations

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