Skip to content

Commit 59cc38d

Browse files
committed
fix(tg_signer): handle bad request errors(such as 'InputUserDeactivated') when sending messages
1 parent 957b67a commit 59cc38d

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

tg_signer/core.py

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -586,9 +586,14 @@ async def run(
586586
for chat in config.chats:
587587
self.context["sign_chats"][chat.chat_id].append(chat)
588588
self.log(f"发送消息至「{chat.chat_id}」")
589-
await self.sign(
590-
chat.chat_id, chat.sign_text, chat.delete_after
591-
)
589+
try:
590+
await self.sign(
591+
chat.chat_id, chat.sign_text, chat.delete_after
592+
)
593+
except errors.BadRequest as e:
594+
self.log(f"发送消息失败:{e}")
595+
continue
596+
592597
if chat.has_keyboard:
593598
self.context["waiting_counter"].add(chat.chat_id)
594599
await asyncio.sleep(0.5)

0 commit comments

Comments
 (0)