From 3294648ebd1dc28304f7de7edeb3b166cb61c08a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=B4=9B=E6=B0=B4=E5=B1=85=E5=AE=A4?= Date: Fri, 6 Jan 2023 18:03:06 +0800 Subject: [PATCH] =?UTF-8?q?=F0=9F=8E=A8=20Update=20Log?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- utils/decorators/error.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/utils/decorators/error.py b/utils/decorators/error.py index 89ca6a5..2bf7ef8 100644 --- a/utils/decorators/error.py +++ b/utils/decorators/error.py @@ -39,7 +39,10 @@ async def send_user_notification(update: Update, context: CallbackContext, text: update_str = update.to_dict() if isinstance(update, Update) else str(update) logger.warning("错误的消息类型\n %s", json.dumps(update_str, indent=2, ensure_ascii=False)) return None - logger.info("尝试通知用户 %s[%s] 在 %s[%s] 的错误信息[%s]", user.full_name, user.id, chat.full_name, chat.id, text) + if chat.id == user.id: + logger.info("尝试通知用户 %s[%s] 错误信息[%s]", user.full_name, user.id, chat.title, chat.id, text) + else: + logger.info("尝试通知用户 %s[%s] 在 %s[%s] 的错误信息[%s]", user.full_name, user.id, chat.title, chat.id, text) try: if update.callback_query: await update.callback_query.answer(text, show_alert=True)