question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Bot disconnecting on each chat message

See original GitHub issue

Actual behaviour: When someone says something in chat, the bot disconnects. I logged in as the bot user to check if it was somehow banned, and it wasn’t. I can talk normally in any chat as the bot via browser.

Expected behaviour: When someone says something in chat, the bot should parse the message an act accordingly.

Error log:

index-0 TWITCH-IRC-ERROR(disconnected):
index-0 [11:10pm] error: Could not connect to server. Trying to reconnect in 0 seconds..
index-0 TWITCH-IRC-ERROR(reconnect): Trying to reconnect.

index-0 Error: not opened
index-0     at WebSocket.send (/home/www/my-bot/node_modules/ws/lib/WebSocket.js:219:16)
index-0     at client.<anonymous> (/home/www/my-bot/node_modules/tmi.js/lib/client.js:186:41)
index-0     at queue.next (/home/www/my-bot/node_modules/tmi.js/lib/timer.js:30:8)
index-0     at null._onTimeout (/home/www/my-bot/node_modules/tmi.js/lib/timer.js:32:14)
index-0     at Timer.listOnTimeout (timers.js:92:15)

The first part is what gets console logged by this:

irc.client.on('disconnected', reason => console.log('TWITCH-IRC-ERROR(disconnected):', reason) );
irc.client.on('reconnect', () => console.log('TWITCH-IRC-ERROR(reconnect): Trying to reconnect.') );

The reason variable seems to be empty. The second part happens when the node proccess crashes.

Server configuration

  • Operating system: Ubuntu
  • Node version (if applicable): 5.1.0
  • NPM version (if applicable): 3.3.12
  • tmi.js version: 0.0.29

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:14 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
johnRivscommented, Apr 19, 2016

Oh thanks very much. I’ve actually wanted something like that for a while. Shame on me for not paying attention to the docs.

Thanks for the help 😄

0reactions
AlcaDesigncommented, Apr 19, 2016

It’s an event emitted by the client: https://tmijs.org/docs/Events.md#notice

Read more comments on GitHub >

github_iconTop Results From Across the Web

Bot Disconnecting - Chat and IRC - Twitch Developer Forums
The disconnect symptoms: When turning the bot on and the stream is offline, the bot disappears in 5 or 10 minutes from the...
Read more >
Bot stops receiving chat message events after running for a ...
We are having an issue with discord.io where message events stop firing after the bot running for a while. The bot can still...
Read more >
Minecraft Bot Disconnects from Server | Mineflayer.js Guides ...
... how to have your bot disconnect from a server on a timer, and include a brief introduction into sending basic chat messages.Github:...
Read more >
Cant get discord.py bot to disconnect from voice chat
You may want to try using server.disconnect(force=True) (documentation) as sometimes disconnecting may be blocked if you don't force it.
Read more >
Fix the constant disconnecting of chat. - Twitch UserVoice
Getting a constant "Welcome to the chat room" message and not being able to interact with my chat as well as any other...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found