diff --git a/.env.example b/.env.example index a9ac8bb..87fe375 100644 --- a/.env.example +++ b/.env.example @@ -16,16 +16,16 @@ REDIS_DB=0 # 联系 https://t.me/BotFather 使用 /newbot 命令创建机器人并获取 token BOT_TOKEN="xxxxxxx" -# 记录错误并发送消息通知开发人员 +# 记录错误并发送消息通知开发人员 可选配置项 ERROR_NOTIFICATION_CHAT_ID=chat_id -# 文章推送群组 +# 文章推送群组 可选配置项 CHANNELS=[{ "name": "", "chat_id": 1}] # bot 管理员 ADMINS=[{ "username": "", "user_id": -1 }] -# 群验证功能 +# 群验证功能 可选配置项 VERIFY_GROUPS=[] # logger 配置 @@ -35,6 +35,9 @@ LOGGER_TIME_FORMAT="[%Y-%m-%d %X]" LOGGER_TRACEBACK_MAX_FRAMES=20 LOGGER_RENDER_KEYWORDS=["BOT"] -# mtp 客户端 +# mtp 客户端 可选配置项 API_ID=12345 API_HASH="abcdefg" + +# ENKA_NETWORK_API 可选配置项 +ENKA_NETWORK_API_AGENT="" \ No newline at end of file diff --git a/core/config.py b/core/config.py index 41e2894..6ef6d52 100644 --- a/core/config.py +++ b/core/config.py @@ -48,6 +48,8 @@ class BotConfig(BaseSettings): logger_traceback_max_frames: int = 20 logger_render_keywords: List[str] = ['BOT'] + enka_network_api_agent: str = "" + class Config: case_sensitive = False json_loads = json.loads diff --git a/plugins/genshin/player_cards.py b/plugins/genshin/player_cards.py index af279a2..93c3357 100644 --- a/plugins/genshin/player_cards.py +++ b/plugins/genshin/player_cards.py @@ -23,6 +23,7 @@ from telegram.constants import ChatAction from telegram.ext import CallbackContext, CallbackQueryHandler, CommandHandler, MessageHandler, filters from core.baseplugin import BasePlugin +from core.config import config from core.plugin import Plugin, handler from core.template import TemplateService from core.user import UserService @@ -43,7 +44,7 @@ assets = Assets(lang="chs") class PlayerCards(Plugin, BasePlugin): def __init__(self, user_service: UserService = None, template_service: TemplateService = None): self.user_service = user_service - self.client = EnkaNetworkAPI(lang="chs", agent="TGPaimonBot/3.0") + self.client = EnkaNetworkAPI(lang="chs", agent=config.enka_network_api_agent) self.template_service = template_service self.temp_photo = open("resources/img/kitsune.png", "rb")