# Unconnect bot from chat

**URL:** <https://discuss.dev.twitch.com/t/unconnect-bot-from-chat/11095>\
**Category:** Chat and IRC\
**Created:** [July 17, 2017, 7:58am UTC](https://discuss.dev.twitch.com/t/unconnect-bot-from-chat/11095 "2017-07-17T07:58:47Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![IvanSteklow](https://d3ovvz0v2ajtpu.cloudfront.net/user_avatar/discuss.dev.twitch.com/ivansteklow/32/3018_2.png) [@IvanSteklow](https://discuss.dev.twitch.com/u/IvanSteklow)\
**Post date:** [July 17, 2017, 7:58am UTC](https://discuss.dev.twitch.com/t/unconnect-bot-from-chat/11095/1 "2017-07-17T07:58:47Z")

</div>

Hi everyone, I have a problem with chat bot. Over time I get blank IRC message and after short time I don’t get any messages from chat. Help me please, what wrong?!

---

<div class="post-metadata">

**Author:** ![BarryCarlyon](https://d3ovvz0v2ajtpu.cloudfront.net/user_avatar/discuss.dev.twitch.com/barrycarlyon/32/253_2.png) [@BarryCarlyon](https://discuss.dev.twitch.com/u/BarryCarlyon)\
**Post date:** [July 17, 2017, 8:11am UTC](https://discuss.dev.twitch.com/t/unconnect-bot-from-chat/11095/2 "2017-07-17T08:11:42Z")

</div>

Sounds like your bot is not responding to PING’s correctly and is being disconnected from chat, which your bot is also not catching

---

<div class="post-metadata">

**Author:** ![IvanSteklow](https://d3ovvz0v2ajtpu.cloudfront.net/user_avatar/discuss.dev.twitch.com/ivansteklow/32/3018_2.png) [@IvanSteklow](https://discuss.dev.twitch.com/u/IvanSteklow)\
**Post date:** [July 17, 2017, 8:13am UTC](https://discuss.dev.twitch.com/t/unconnect-bot-from-chat/11095/3 "2017-07-17T08:13:09Z")

</div>

No, my bot catching Ping correctly:  
`PONG :tmi.twitch.tv`

---

<div class="post-metadata">

**Author:** ![IllusionaryOne](https://d3ovvz0v2ajtpu.cloudfront.net/user_avatar/discuss.dev.twitch.com/illusionaryone/32/2011_2.png) [@IllusionaryOne](https://discuss.dev.twitch.com/u/IllusionaryOne)\
**Post date:** [July 17, 2017, 4:59pm UTC](https://discuss.dev.twitch.com/t/unconnect-bot-from-chat/11095/4 "2017-07-17T16:59:37Z")

</div>

I discovered, and I think it was Barry or another person that pointed it out to me, that you at times have to send a PING yourself. For example, I found with a bot that I work on, that if users run it from the Azure Cloud, that it times out well before Twitch sends a PING. Have you tried implementing a PING yourself more frequently? This is precisely what I had to do in some instances.

---

<div class="post-metadata">

**Author:** ![BarryCarlyon](https://d3ovvz0v2ajtpu.cloudfront.net/user_avatar/discuss.dev.twitch.com/barrycarlyon/32/253_2.png) [@BarryCarlyon](https://discuss.dev.twitch.com/u/BarryCarlyon)\
**Post date:** [July 17, 2017, 5:18pm UTC](https://discuss.dev.twitch.com/t/unconnect-bot-from-chat/11095/5 "2017-07-17T17:18:12Z")

</div>

Yeah, most of my bots don’t get a ping in a paticular timeframe so I/the bot pings itself.

My next suggestion would be to pull the RAW IRC lines and see if theres an error or disconnect.

And/or if you bot framework has a PING timeout for “missed”(never sent) server pings

---

<div class="post-metadata">

**Author:** ![IvanSteklow](https://d3ovvz0v2ajtpu.cloudfront.net/user_avatar/discuss.dev.twitch.com/ivansteklow/32/3018_2.png) [@IvanSteklow](https://discuss.dev.twitch.com/u/IvanSteklow)\
**Post date:** [July 17, 2017, 6:36pm UTC](https://discuss.dev.twitch.com/t/unconnect-bot-from-chat/11095/6 "2017-07-17T18:36:50Z")

</div>

![](https://d2opxh93rbxzdn.cloudfront.net/original/2X/1/1f5cbae314961786c275eeb5d3d325b8faa732c3.png)

---

<div class="post-metadata">

**Author:** ![IllusionaryOne](https://d3ovvz0v2ajtpu.cloudfront.net/user_avatar/discuss.dev.twitch.com/illusionaryone/32/2011_2.png) [@IllusionaryOne](https://discuss.dev.twitch.com/u/IllusionaryOne)\
**Post date:** [July 17, 2017, 7:02pm UTC](https://discuss.dev.twitch.com/t/unconnect-bot-from-chat/11095/7 "2017-07-17T19:02:35Z")

</div>

Are you catching any particular errors from your IRC connection to see if the connection is closed by either the server or client? I do see that you stop receiving messages, but nothing else of value, unfortunately.

---

<div class="post-metadata">

**Author:** ![IvanSteklow](https://d3ovvz0v2ajtpu.cloudfront.net/user_avatar/discuss.dev.twitch.com/ivansteklow/32/3018_2.png) [@IvanSteklow](https://discuss.dev.twitch.com/u/IvanSteklow)\
**Post date:** [July 17, 2017, 7:04pm UTC](https://discuss.dev.twitch.com/t/unconnect-bot-from-chat/11095/8 "2017-07-17T19:04:23Z")

</div>

How to catch errors?

---

<div class="post-metadata">

**Author:** ![IllusionaryOne](https://d3ovvz0v2ajtpu.cloudfront.net/user_avatar/discuss.dev.twitch.com/illusionaryone/32/2011_2.png) [@IllusionaryOne](https://discuss.dev.twitch.com/u/IllusionaryOne)\
**Post date:** [July 17, 2017, 7:20pm UTC](https://discuss.dev.twitch.com/t/unconnect-bot-from-chat/11095/9 "2017-07-17T19:20:02Z")

</div>

I do not know what language you are using for your bot. I use Java and wrote an interface that uses WebSockets to communicate with Twitch WS IRC servers. For that, internally, I catch any error that comes from the WebSocket interface and log it and then attempt a reconnect, for example.

Your solution would be based on (a) what language you are using and (b) what library (if any) you are using.

---

<div class="post-metadata">

**Author:** ![system](https://d2opxh93rbxzdn.cloudfront.net/original/2X/0/05909729875cce3b53e59d5561c4d23bb14948fc.png) [@system](https://discuss.dev.twitch.com/u/system)\
**Post date:** [August 16, 2017, 7:20pm UTC](https://discuss.dev.twitch.com/t/unconnect-bot-from-chat/11095/10 "2017-08-16T19:20:03Z")

</div>

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.
