kritzware / twitch-bot

🤖 Easily create chat bots for Twitch.tv
https://www.npmjs.com/package/twitch-bot
MIT License
149 stars 36 forks source link

'Join' event is not working #38

Closed pdom0327 closed 6 years ago

pdom0327 commented 6 years ago

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.

kritzware commented 6 years ago

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.

pdom0327 commented 6 years ago

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