How to make a chatbot join a channel using JS?

Ok, so I made a Twitch chatbot and want to connect to multiple channels. But I can only make it send messages in his own stream chat. Should I add the channel name in the channels option in the options? Or should I do something else. Please tell me. Kthxbai.

We’d have to see your code.

JS is all well and good, but are you doing it in pure websockets? Using a library, using node-irc, using some other IRC library, using TMI.js?

I am using TMI.js. Here’s my code:

const tmi = require("tmi.js");
const fs = require("fs");

const settings = {
  options: {
    clientId: process.env.CLIENTID,
    debug: true
  },
  connection: {
    cluster: "aws",
    reconnect: true
  },
  identity: {
    username: "codiacbot",
    password: process.env.SECRET
  },
  channels: ["#codiacbot", "#sunsogtwitch"]
};

const client = new tmi.client(settings);

client.connect();

Docs for TMI.js are here

https://docs.tmijs.org/

Support forum/issues is here:

Can’t really help with tmi.js on the Twitch Third party developers forum, you’d get better help with tmi.js on the tmi.js support location.

As per

https://docs.tmijs.org/v1.2.1/Configuration.html

I don’t see anything obviously wrong with your code, but I don’t use TMI.js might be a issue with that library

Also you can use twitch-js. It’s community supported version of tmi.js

You need to check 2.X version

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