IRC Bot disconnects with EOF unless it joins its own channel

No, this is not expected behaviour. Most likely there is something wrong in your code. Perhaps you handle being in your own channel differently than being in others.

If you can’t find it yourself, post relevant code here and maybe I or someone else here can help. By the way you only need to send a PONG when you’ve received a PING.

Automatically reconnecting is not a bad idea regardless of your issues, this would look something like:

if str, err = reader.ReadString('\n'); err != nil {
    if err == io.EOF {
        //reconnect
        //rejoin previous channels
    }
}
1 Like