mirror of
https://github.com/osmarks/autobotrobot
synced 2025-01-31 09:34:44 +00:00
Hopefully working autoreconnect
This commit is contained in:
parent
e3baa2cd90
commit
bdb32764fb
@ -71,9 +71,14 @@ async def initialize():
|
|||||||
logging.info("Connected to %s on IRC", channel)
|
logging.info("Connected to %s on IRC", channel)
|
||||||
joined.add(channel)
|
joined.add(channel)
|
||||||
|
|
||||||
|
def disconnect(conn, event):
|
||||||
|
logging.warn("Disconnected from IRC, reinitializing")
|
||||||
|
teardown()
|
||||||
|
asyncio.create_task(initialize)
|
||||||
|
|
||||||
# TODO: do better thing
|
# TODO: do better thing
|
||||||
conn.add_global_handler("welcome", connect)
|
conn.add_global_handler("welcome", connect)
|
||||||
conn.add_global_handler("disconnect", lambda conn, event: logging.warn("Disconnected from IRC"))
|
conn.add_global_handler("disconnect", disconnect)
|
||||||
conn.add_global_handler("nicknameinuse", inuse)
|
conn.add_global_handler("nicknameinuse", inuse)
|
||||||
conn.add_global_handler("pubmsg", pubmsg)
|
conn.add_global_handler("pubmsg", pubmsg)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user