Update tgbot.py

This commit is contained in:
midoks 2023-03-28 16:31:46 +08:00
parent 8cf526667e
commit 49c7ec6073
1 changed files with 15 additions and 1 deletions

View File

@ -179,6 +179,17 @@ def setDaemon(t):
else:
t.setDaemon(True)
def runBot(bot):
try:
bot.polling()
except Exception as e:
writeLog('-----runBot error start -------')
writeLog(str(e))
writeLog('-----runBot error end -------')
time.sleep(1)
runBot(bot)
if __name__ == "__main__":
# 机器人推送任务
@ -190,5 +201,8 @@ if __name__ == "__main__":
botPushOtherTask.start()
writeLog('启动成功')
bot.polling()
runBot(bot)
# asyncio.run(bot.polling())