]> git.treefish.org Git - mtxbot.git/blobdiff - src/mtxbot.py
Fix presence shutdown
[mtxbot.git] / src / mtxbot.py
index 722c8dbb40097d514e70f61ce4da5147b8e12d95..011341f85b7204a6674a886112729c1da503d16f 100755 (executable)
@@ -36,6 +36,9 @@ async def main():
         done, pending = await asyncio.wait( presence_tasks,
                                             return_when = asyncio.FIRST_EXCEPTION )
 
         done, pending = await asyncio.wait( presence_tasks,
                                             return_when = asyncio.FIRST_EXCEPTION )
 
+        for presence in presences:
+            presence.stop()
+
         for task in done:
             try:
                 task.result()
         for task in done:
             try:
                 task.result()
@@ -43,6 +46,7 @@ async def main():
                 logging.error( "Error running task: %s" % str(e) )
 
     finally:
                 logging.error( "Error running task: %s" % str(e) )
 
     finally:
+        logging.info("Closing client...")
         await client.close()
 
 logging.basicConfig(format='[%(asctime)s] %(levelname)s: %(message)s',
         await client.close()
 
 logging.basicConfig(format='[%(asctime)s] %(levelname)s: %(message)s',
@@ -51,6 +55,7 @@ logging.basicConfig(format='[%(asctime)s] %(levelname)s: %(message)s',
 
 mainPid = os.getpid()
 signal.signal(signal.SIGINT, handleInterrupt)
 
 mainPid = os.getpid()
 signal.signal(signal.SIGINT, handleInterrupt)
+signal.signal(signal.SIGTERM, handleInterrupt)
 
 stop = False
 
 
 stop = False