From 827b97e36d248e8256eb87d81e0082f76ceba79a 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, 21 Nov 2022 20:50:08 +0800 Subject: [PATCH] =?UTF-8?q?=F0=9F=8E=A8=20Add=20`filters.ChatType.PRIVATE`?= =?UTF-8?q?=20to=20Verify=20Command=20And=20Update=20Log?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- plugins/genshin/verification.py | 6 +++--- plugins/system/webapp.py | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/plugins/genshin/verification.py b/plugins/genshin/verification.py index e0c5345d..2302f5f4 100644 --- a/plugins/genshin/verification.py +++ b/plugins/genshin/verification.py @@ -2,7 +2,7 @@ from typing import Tuple, Optional from genshin import Region, GenshinException from telegram import Update, WebAppInfo, KeyboardButton, ReplyKeyboardMarkup -from telegram.ext import CallbackContext +from telegram.ext import CallbackContext, filters from core.base.redisdb import RedisDB from core.baseplugin import BasePlugin @@ -43,7 +43,7 @@ class VerificationPlugins(Plugin, BasePlugin): self.user_service = user_service self.system = VerificationSystem(redis) - @handler.command("verify", block=False) + @handler.command("verify", filters=filters.ChatType.PRIVATE, block=False) @restricts(restricts_time=60) @error_callable async def verify(self, update: Update, context: CallbackContext) -> None: @@ -78,7 +78,7 @@ class VerificationPlugins(Plugin, BasePlugin): data = await verification.create(is_high=is_high) challenge = data["challenge"] gt = data["gt"] - logger.success("用户 %s[%s] 创建验证成功\ngt:%s\nchallenge%s", user.full_name, user.id, gt, challenge) + logger.success("用户 %s[%s] 创建验证成功\ngt[%s]\nchallenge[%s]", user.full_name, user.id, gt, challenge) except ResponseException as exc: logger.warning("用户 %s[%s] 创建验证失效 API返回 [%s]%s", user.full_name, user.id, exc.code, exc.message) await message.reply_text(f"创建验证失败 错误信息为 [{exc.code}]{exc.message} 请稍后重试") diff --git a/plugins/system/webapp.py b/plugins/system/webapp.py index 8a98b122..c70037c6 100644 --- a/plugins/system/webapp.py +++ b/plugins/system/webapp.py @@ -55,7 +55,7 @@ class WebApp(Plugin): if web_app_data: logger.info("用户 %s[%s] 触发 WEB_APP_DATA 请求", user.full_name, user.id) result = self.de_web_app_data(web_app_data.data) - logger.debug("path:%s\ndata:%s\ncode:%s\nmessage:%s", result.path, result.data, result.code, result.message) + logger.debug("path[%s]\ndata[%s]\ncode[%s]\nmessage[%s]", result.path, result.data, result.code, result.message) if result.code == 0: if result.path == "verify": validate = result.data.get("geetest_validate") @@ -75,7 +75,7 @@ class WebApp(Plugin): _, challenge = await self.verification_system.get_challenge(client.uid) if challenge: logger.info( - "用户 %s[%s] 请求通过认证\nchallenge:%s\nvalidate:%s", + "用户 %s[%s] 请求通过认证\nchallenge[%s]\nvalidate[%s]", user.full_name, user.id, challenge,