Is it possible to make a glitch node.js twitch bot work on multiple channels?

Ideally I’d love to be able to make a site or a URL that allows people to authorise with their twitch account to add the bot to their channel, but even if there’s a way I can manually add multiple channels directly, that would help me manage for now!

I’m using the TMI.js API at the moment. I know Node.js is a single thread type situation, and I did see things online about stuff like “cluster”, but it’s far beyond my understanding at this point- this is my first foray into anything web / network code based…!

There are two ways you can get your bot to join a channel using tmi.js.

Either you can specify the channels when creating the client:

const client = new tmi.client({
  identity: {
    username: 'USERNAME',
    password: 'PASSWORD'
  channels: [

Or you can use the join command:


If you want people to add your bot to their channel themself, you will need a combination of both.

I have never made a Twitch bot for public use, so this may not be the best solution, but I would propably make a !join command, that when used on the bot’s channel will make the bot join the users channel.

Something like this (untested code):

client.on('message', (channel, tags, message, self) => {
  if (self) {
  if(message.toLowerCase() === '!join') {
    if (channel !== 'YOUR_BOT_CHANNEL') {

You would also need to save the channels to a database, so they are not lost when your project restarts. You can then use the first code example to make your bot rejoin the saved channels when you create the client.

1 Like

Hey! Thank you so much! I was trying this using .env variables to hold each channel name (just while testing stuff) but for some reason it just WOULD NOT work that way, but when I did it manually by typing the strings out like you did, it connected to both of them just fine!

That’s a really good idea with the bot’s own chat channel being how to join. Thank you!!

1 Like