kritzware/twitch-bot

Bot does not work

Closed this issue ยท 11 comments

I get the following error message, when I try to test the bot (I just started the example with my oauth key, username and channel name):

badges = badges.split(',')
^

TypeError: Cannot read property 'split' of null
at Object.formatPRIVMSG (\lib\parser.js:37:20)
at TLSSocket.irc.on.data (\lib\bot.js:64:32)
at emitOne (events.js:115:13)
at TLSSocket.emit (events.js:210:7)
at addChunk (_stream_readable.js:252:12)
at readableAddChunk (_stream_readable.js:235:13)
at TLSSocket.Readable.push (_stream_readable.js:197:10)
at TLSWrap.onread (net.js:589:20)

Hi @MSchutt,

I've just pushed a fix for this error and it should now (hopefully) work fine for you! Let me know if you need help with anything ๐Ÿ˜„

Cheers,

kritzware

Hello!

Thank you for the response and the fix - unfortunatly it still does not work => when I start the bot and type !test in the Chat nothing happens (no error message or something)
Still using the example code with my username, oauth and channel

Thanks

Hi @MSchutt,

Are you using the error event to listen for errors?

Bot.on('error', err => {
    console.log(err)
})

Cheers,

kritzware

Hi @kritzware,

Yes I do, but I do not get any errors. That's the code I currently have:

const TwitchBot = require('twitch-bot');
const Bot = new TwitchBot({
  username: 'xxx',
  oauth: "xxxx",
  channel: 'xxx'
});
Bot.on('join', function() {
  console.log("connected!");
    Bot.on('message', function(chatter) {
      console.log("message!");
      if(chatter.message === '!test') {
        Bot.say('Command executed! PogChamp')
      }
    })
});

Bot.on('error', function(err) {
  console.log(err);
});

That's the output I get logged in my console:
connected!
(I type something in Twitch Chat)
message!
(I type !test in Twitch Chat)
message!
[Unfortunatly it does not send a message & a error is also not logged]

Thanks! ๐Ÿ‘

Which version of twitch-bot are you using? You can check this in your package.json file.

1.0.4

I can't seem to replicate this error. Can you double check you are definitely using the correct oauth token? Make sure you include oauth in the string that you pass in.

const Bot = new TwitchBot({
  username: 'bot_username',
  oauth: 'oauth:abcdefghijk123',
  channel: '#mschutt'
})

Hi, that's the code I tried now:

Bot.on('join', function() {
  Bot.say('Bot connected!');
  Bot.on('message', function(chatter) {
    console.log('say something now!');
    Bot.say('Hallo! Kappa');
  });
});

When I connect the bot even says "Bot connected!" in the Twitch-Chat
and when I now type something it evens logs "say something now!" but no message appears in the Twitch-Chat!

Is the account you're using for the bot a moderator in the channel you're connected to? Maybe it's being rate limited because you're sending messages too quickly?

Yeah - that was the issue. I have now logged in my other account and started the bot and now it works just fine!

Thanks alot for the support! ๐Ÿ‘

Glad it works now ๐Ÿ‘