🎨inline_query 函数添加 error_callable 修饰器

This commit is contained in:
洛水居室 2022-10-17 18:17:46 +08:00
parent 0120984991
commit 0c51dd3c5d
No known key found for this signature in database
GPG Key ID: C9DE87DA724B88FC
2 changed files with 4 additions and 0 deletions

View File

@ -8,6 +8,7 @@ from telegram.ext import CallbackContext, InlineQueryHandler
from core.plugin import handler, Plugin from core.plugin import handler, Plugin
from core.wiki import WikiService from core.wiki import WikiService
from utils.decorators.error import error_callable
from utils.log import logger from utils.log import logger
@ -18,6 +19,7 @@ class Inline(Plugin):
self.wiki_service = wiki_service self.wiki_service = wiki_service
@handler(InlineQueryHandler, block=False) @handler(InlineQueryHandler, block=False)
@error_callable
async def inline_query(self, update: Update, _: CallbackContext) -> None: async def inline_query(self, update: Update, _: CallbackContext) -> None:
user = update.effective_user user = update.effective_user
ilq = cast(InlineQuery, update.inline_query) ilq = cast(InlineQuery, update.inline_query)

View File

@ -15,6 +15,8 @@ from utils.log import logger
async def send_user_notification(update: Update, _: CallbackContext, text: str): 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 effective_user = update.effective_user
message = update.effective_message message = update.effective_message
if message is None: if message is None: