require('dotenv').config();
var config = require('./config');
const tmi = require('tmi.js');
const client = new tmi.Client({
options: { debug: true },
identity: {
username: process.env.BOT_USERNAME,
password: process.env.OAUTH_TOKEN
},
channels: [ config.channel ]
});
client.connect();
client.on('connected', (address, port, channel ) =>{
client.action(config.channel, config.connectedmessage)
});
client.on('chat', (channel, user, message, self) => {
if (message ==='!join'){
client.action(config.channel, `${user['display-name']} ${config.joinmessage}`);
let newchannel = user['display-name'].toLowerCase()
console.log(newchannel)
};
});
So i was thinking i would get the new channel name where to connect the bot by making people type !join in the main channel . So i would get their twitch name channel with this function, but i wonder if anyone knows what i can do there to make my bot connect to that channel