def start(self):
"""The main loop keeping the bot alive"""
self.connect(self.current_server)
while self.running:
# No need to busy-wait
time.sleep(0.2)
self.schedule.execute()
# Skip polling etc. if we're reconnecting
if self.reconnecting and not self.connected:
continue
try:
asyncore.poll(timeout=10, map={self.socket: self})
except socket.error as e:
log.error(e)
self.reconnect_with_delay()
continue
dc_channels = self.disconnected_channels()
if dc_channels:
self.join(dc_channels, delay=5)
评论列表
文章目录