修改了程序发生异常时发送消息通知为群消息
This commit is contained in:
parent
668e274ab2
commit
90a5c71e43
@ -7,7 +7,7 @@ import requests
|
||||
from aiohttp import ClientError
|
||||
|
||||
from src import logger
|
||||
from src.core.constant import BOT_TOKEN, CHAT_ID
|
||||
from src.core.constant import BOT_TOKEN, GROUP_ID
|
||||
from src.core.login import login
|
||||
from src.core.message_client import send_message
|
||||
from src.entity.account import Account
|
||||
@ -60,13 +60,13 @@ def account_post(url: str, account: Account, params: dict) -> ApiResponse[Any]:
|
||||
logger.error(f"Client error occurred: {e}")
|
||||
except TimeoutError as e:
|
||||
logger.error(f"")
|
||||
send_message(BOT_TOKEN, CHAT_ID, f'{account.url}:加载超时,请检查是否后台更换了链接')
|
||||
send_message(BOT_TOKEN, GROUP_ID, f'{account.url}:加载超时,请检查是否后台更换了链接')
|
||||
except Exception as e:
|
||||
logger.error(f"Unknown error: {e}")
|
||||
|
||||
time.sleep(10)
|
||||
|
||||
send_message(BOT_TOKEN, CHAT_ID, f'{account.url}: Retry limit exceeded, please check the code')
|
||||
send_message(BOT_TOKEN, GROUP_ID, f'{account.url}: Retry limit exceeded, please check the code')
|
||||
logger.error(f"{account.url}: Retry limit exceeded, please check the code")
|
||||
|
||||
|
||||
@ -88,6 +88,5 @@ async def async_account_post(url: str, account: Account, params: dict) -> ApiRes
|
||||
# Add a delay before retrying
|
||||
await asyncio.sleep(10)
|
||||
|
||||
send_message(BOT_TOKEN, CHAT_ID, f'{account.url}: Retry limit exceeded, please check the code')
|
||||
send_message(BOT_TOKEN, GROUP_ID, f'{account.url}: Retry limit exceeded, please check the code')
|
||||
logger.error("Retry limit exceeded, please check the code")
|
||||
# You can raise a custom exception here or return an error status code
|
||||
|
Loading…
Reference in New Issue
Block a user