diff --git a/.env.example b/.env.example index 4c3c2d9..5533906 100644 --- a/.env.example +++ b/.env.example @@ -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="再乱点我叫西风骑士团、千岩军、天领奉行、三十人团和风纪官了!" \ No newline at end of file diff --git a/core/config.py b/core/config.py index 8745449..9724ffb 100644 --- a/core/config.py +++ b/core/config.py @@ -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() diff --git a/plugins/genshin/player_cards.py b/plugins/genshin/player_cards.py index e382b06..b169761 100644 --- a/plugins/genshin/player_cards.py +++ b/plugins/genshin/player_cards.py @@ -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) diff --git a/plugins/genshin/sign.py b/plugins/genshin/sign.py index 2ecd388..9796ca5 100644 --- a/plugins/genshin/sign.py +++ b/plugins/genshin/sign.py @@ -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: diff --git a/plugins/system/auth.py b/plugins/system/auth.py index 007d668..ff75c55 100644 --- a/plugins/system/auth.py +++ b/plugins/system/auth.py @@ -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: