🎨 Add filters.ChatType.PRIVATE to Verify Command And Update Log

This commit is contained in:
洛水居室 2022-11-21 20:50:08 +08:00
parent bda5f4fdd0
commit 827b97e36d
No known key found for this signature in database
GPG Key ID: C9DE87DA724B88FC
2 changed files with 5 additions and 5 deletions

View File

@ -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} 请稍后重试")

View File

@ -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,