kritzware/twitch-bot

'Join' event is not working

Closed this issue · 2 comments

I can not see the Joined channel: $ {channel} message in console. The 'message' event worked fine.
Did I miss something?

require("dotenv").config();

const TwitchBot = require("twitch-bot");

const twitchBot = new TwitchBot({
  username: "KimDexBot",
  oauth: process.env.TWITCH_TOKEN,
  channels: ["twitch"]
});

twitchBot.on("join", channel => {
  console.log(`Joined channel: ${channel}`);
});

......
{
  "name": "KimDexBot",
  "version": "0.0.0",
  "scripts": {
    "start": "node ./index.js"
  },
  "dependencies": {
    "discord.js": "^11.4.2",
    "dotenv": "^6.1.0",
    "mysql2": "^1.6.1",
    "sequelize": "^4.41.0",
    "twitch-bot": "^1.2.5"
  }
}

I used Google Translator.

Hi,

I'm not able to reproduce this error with the following code (in a new project, using node v10.13.0 and v1.2.5 of the bot:

const TwitchBot = require('twitch-bot')

const Bot = new TwitchBot({
    username: process.env.TWITCHBOT_USERNAME,
    oauth: process.env.TWITCHBOT_OAUTH,
    channels: ['#kritzware']
})

Bot.on('join', channel => console.log('joined channel:', channel))
Bot.on('message', chatter => console.log(chatter))
Bot.on('error', err => console.log(err))

When I run this snippet, it prints that the channel was joined with the channel name.

I changed the upper case of the username to lower case. Then the problem is resolved. Thank you!