mirror of
https://github.com/PaiGramTeam/PamGram.git
synced 2024-11-22 06:17:54 +00:00
🎨 添加 enka_network_api_agent
可选配置项
This commit is contained in:
parent
51dc36e913
commit
0f343a0e3c
11
.env.example
11
.env.example
@ -16,16 +16,16 @@ REDIS_DB=0
|
|||||||
# 联系 https://t.me/BotFather 使用 /newbot 命令创建机器人并获取 token
|
# 联系 https://t.me/BotFather 使用 /newbot 命令创建机器人并获取 token
|
||||||
BOT_TOKEN="xxxxxxx"
|
BOT_TOKEN="xxxxxxx"
|
||||||
|
|
||||||
# 记录错误并发送消息通知开发人员
|
# 记录错误并发送消息通知开发人员 可选配置项
|
||||||
ERROR_NOTIFICATION_CHAT_ID=chat_id
|
ERROR_NOTIFICATION_CHAT_ID=chat_id
|
||||||
|
|
||||||
# 文章推送群组
|
# 文章推送群组 可选配置项
|
||||||
CHANNELS=[{ "name": "", "chat_id": 1}]
|
CHANNELS=[{ "name": "", "chat_id": 1}]
|
||||||
|
|
||||||
# bot 管理员
|
# bot 管理员
|
||||||
ADMINS=[{ "username": "", "user_id": -1 }]
|
ADMINS=[{ "username": "", "user_id": -1 }]
|
||||||
|
|
||||||
# 群验证功能
|
# 群验证功能 可选配置项
|
||||||
VERIFY_GROUPS=[]
|
VERIFY_GROUPS=[]
|
||||||
|
|
||||||
# logger 配置
|
# logger 配置
|
||||||
@ -35,6 +35,9 @@ LOGGER_TIME_FORMAT="[%Y-%m-%d %X]"
|
|||||||
LOGGER_TRACEBACK_MAX_FRAMES=20
|
LOGGER_TRACEBACK_MAX_FRAMES=20
|
||||||
LOGGER_RENDER_KEYWORDS=["BOT"]
|
LOGGER_RENDER_KEYWORDS=["BOT"]
|
||||||
|
|
||||||
# mtp 客户端
|
# mtp 客户端 可选配置项
|
||||||
API_ID=12345
|
API_ID=12345
|
||||||
API_HASH="abcdefg"
|
API_HASH="abcdefg"
|
||||||
|
|
||||||
|
# ENKA_NETWORK_API 可选配置项
|
||||||
|
ENKA_NETWORK_API_AGENT=""
|
@ -48,6 +48,8 @@ class BotConfig(BaseSettings):
|
|||||||
logger_traceback_max_frames: int = 20
|
logger_traceback_max_frames: int = 20
|
||||||
logger_render_keywords: List[str] = ['BOT']
|
logger_render_keywords: List[str] = ['BOT']
|
||||||
|
|
||||||
|
enka_network_api_agent: str = ""
|
||||||
|
|
||||||
class Config:
|
class Config:
|
||||||
case_sensitive = False
|
case_sensitive = False
|
||||||
json_loads = json.loads
|
json_loads = json.loads
|
||||||
|
@ -23,6 +23,7 @@ from telegram.constants import ChatAction
|
|||||||
from telegram.ext import CallbackContext, CallbackQueryHandler, CommandHandler, MessageHandler, filters
|
from telegram.ext import CallbackContext, CallbackQueryHandler, CommandHandler, MessageHandler, filters
|
||||||
|
|
||||||
from core.baseplugin import BasePlugin
|
from core.baseplugin import BasePlugin
|
||||||
|
from core.config import config
|
||||||
from core.plugin import Plugin, handler
|
from core.plugin import Plugin, handler
|
||||||
from core.template import TemplateService
|
from core.template import TemplateService
|
||||||
from core.user import UserService
|
from core.user import UserService
|
||||||
@ -43,7 +44,7 @@ assets = Assets(lang="chs")
|
|||||||
class PlayerCards(Plugin, BasePlugin):
|
class PlayerCards(Plugin, BasePlugin):
|
||||||
def __init__(self, user_service: UserService = None, template_service: TemplateService = None):
|
def __init__(self, user_service: UserService = None, template_service: TemplateService = None):
|
||||||
self.user_service = user_service
|
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.template_service = template_service
|
||||||
self.temp_photo = open("resources/img/kitsune.png", "rb")
|
self.temp_photo = open("resources/img/kitsune.png", "rb")
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user