From 0c51dd3c5d6027fa8cd65ab8ce9561f4ada9ecf6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=B4=9B=E6=B0=B4=E5=B1=85=E5=AE=A4?= Date: Mon, 17 Oct 2022 18:17:46 +0800 Subject: [PATCH] =?UTF-8?q?=F0=9F=8E=A8=20=E4=B8=BA=20`inline=5Fquery`=20?= =?UTF-8?q?=E5=87=BD=E6=95=B0=E6=B7=BB=E5=8A=A0=20`error=5Fcallable`=20?= =?UTF-8?q?=E4=BF=AE=E9=A5=B0=E5=99=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- plugins/system/inline.py | 2 ++ utils/decorators/error.py | 2 ++ 2 files changed, 4 insertions(+) diff --git a/plugins/system/inline.py b/plugins/system/inline.py index df7e88c..9f8dc0a 100644 --- a/plugins/system/inline.py +++ b/plugins/system/inline.py @@ -8,6 +8,7 @@ from telegram.ext import CallbackContext, InlineQueryHandler from core.plugin import handler, Plugin from core.wiki import WikiService +from utils.decorators.error import error_callable from utils.log import logger @@ -18,6 +19,7 @@ class Inline(Plugin): self.wiki_service = wiki_service @handler(InlineQueryHandler, block=False) + @error_callable async def inline_query(self, update: Update, _: CallbackContext) -> None: user = update.effective_user ilq = cast(InlineQuery, update.inline_query) diff --git a/utils/decorators/error.py b/utils/decorators/error.py index 8a9337e..f84ae1c 100644 --- a/utils/decorators/error.py +++ b/utils/decorators/error.py @@ -15,6 +15,8 @@ from utils.log import logger async def send_user_notification(update: Update, _: CallbackContext, text: str): + if update.inline_query is not None: # 忽略 inline_query + return effective_user = update.effective_user message = update.effective_message if message is None: