Rules for disconnecting IRC channels from IRC?

without seeing some of your code can’t know for sure
odds are if theres your not getting messages on certain channels that often the s.recv is waiting for data so it never gets to your ping pong responses

You can ping your self on a thread and that could keep u connected