🎨 Move All user_mismatch Notice to the Aame Place

This commit is contained in:
Nahida 2023-01-08 04:01:28 +08:00 committed by GitHub
parent 834dd30b7e
commit 764834de2f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 16 additions and 4 deletions

View File

@ -79,3 +79,6 @@ LOGGER_FILTERED_NAMES=["uvicorn","ErrorPush","ApiHelper"]
# ERROR_PB_SUNSET=43200
# ERROR_PB_MAX_LINES=1000
# ERROR_SENTRY_DSN=
# Notice
NOTICE_USER_MISMATCH="再乱点我叫西风骑士团、千岩军、天领奉行、三十人团和风纪官了!"

View File

@ -96,6 +96,13 @@ class ErrorConfig(Settings):
env_prefix = "error_"
class NoticeConfig(Settings):
user_mismatch: str = "再乱点我叫西风骑士团、千岩军、天领奉行、三十人团和风纪官了!"
class Config(Settings.Config):
env_prefix = "notice_"
class BotConfig(Settings):
debug: bool = False
@ -125,6 +132,7 @@ class BotConfig(Settings):
redis: RedisConfig = RedisConfig()
mtproto: MTProtoConfig = MTProtoConfig()
error: ErrorConfig = ErrorConfig()
notice: NoticeConfig = NoticeConfig()
BotConfig.update_forward_refs()

View File

@ -157,7 +157,7 @@ class PlayerCards(Plugin, BasePlugin):
result, user_id, uid = await get_player_card_callback(callback_query.data)
if user.id != user_id:
await callback_query.answer(text="这不是你的按钮!\n" "再乱点再按我叫西风骑士团、千岩军、天领奉行和教令院了!", show_alert=True)
await callback_query.answer(text="这不是你的按钮!\n" + config.notice.user_mismatch, show_alert=True)
return
logger.info(f"用户 {user.full_name}[{user.id}] 角色卡片查询命令请求 || character_name[{result}] uid[{uid}]")
data = await self._fetch_user(uid)

View File

@ -424,7 +424,7 @@ class Sign(Plugin, BasePlugin):
user_id, uid = await get_sign_callback(callback_query.data)
if user.id != user_id:
await callback_query.answer(text="这不是你的按钮!\n" "再乱点再按我叫西风骑士团、千岩军、天领奉行和教令院了!", show_alert=True)
await callback_query.answer(text="这不是你的按钮!\n" + config.notice.user_mismatch, show_alert=True)
return
_, challenge = await self.system.get_challenge(uid)
if not challenge:

View File

@ -12,6 +12,7 @@ from telegram.helpers import escape_markdown
from core.base.mtproto import MTProto
from core.base.redisdb import RedisDB
from core.bot import bot
from core.config import config
from core.plugin import Plugin, handler
from core.quiz import QuizService
from utils.chatmember import extract_status_change
@ -151,7 +152,7 @@ class GroupJoiningVerification(Plugin):
chat_administrators = await self.get_chat_administrators(context, chat_id=chat.id)
if not self.is_admin(chat_administrators, user.id):
logger.debug(f"用户 {user.full_name}[{user.id}] 在群 {chat.title}[{chat.id}] 非群管理")
await callback_query.answer(text="你不是管理!\n" "再乱点我叫西风骑士团、千岩军和天领奉行了!", show_alert=True)
await callback_query.answer(text="你不是管理!\n" + config.notice.user_mismatch, show_alert=True)
return
result, user_id = await admin_callback(callback_query.data)
try:
@ -216,7 +217,7 @@ class GroupJoiningVerification(Plugin):
user_id, result, question, answer = await query_callback(callback_query.data)
logger.info(f"用户 {user.full_name}[{user.id}] 在群 {chat.title}[{chat.id}] 点击Auth认证命令 ")
if user.id != user_id:
await callback_query.answer(text="这不是你的验证!\n" "再乱点再按我叫西风骑士团、千岩军和天领奉行了!", show_alert=True)
await callback_query.answer(text="这不是你的验证!\n" + config.notice.user_mismatch, show_alert=True)
return
logger.info(f"用户 {user.full_name}[{user.id}] 在群 {chat.title}[{chat.id}] 认证结果为 {'通过' if result else '失败'}")
if result: