diff --git a/src/change_url/change_url_bot.py b/src/change_url/change_url_bot.py index ddb94aa..df7a2ef 100644 --- a/src/change_url/change_url_bot.py +++ b/src/change_url/change_url_bot.py @@ -1,10 +1,11 @@ import telebot import requests +import time from loguru import logger from src.change_url.change_url import change_url -TOKEN = '6013830443:AAGzq1Tgtr_ZejU7bv0mab14xOwi0_64d0w' +TOKEN = '6356456493:AAF2J03isyhlOFF6WgoovRCzuvHheTrTKmM' bot = telebot.TeleBot(TOKEN) ky = ['技术客服域名值班'] hth = ['YYZBH②拒绝私聊', '3-信息同步频道'] @@ -49,4 +50,16 @@ def handle_forwarded_message(message): bot.reply_to(message, msg) -bot.polling(none_stop=True) +def start_polling(): + while True: + try: + bot.polling(none_stop=True) + except Exception as e: + logger.error(f"长轮询异常: {e}") + # 在重新尝试前暂停一段时间 + time.sleep(15) + + +if __name__ == "__main__": + start_polling() # 开始长轮询 +