mirror of
https://github.com/PaiGramTeam/PamGram.git
synced 2024-11-21 21:58:04 +00:00
🔧 支持使用配置文件是否启用 genshin.py
模块的缓存
This commit is contained in:
parent
bf90ca55f9
commit
291b21f674
@ -53,6 +53,9 @@ LOGGER_LOCALS_MAX_STRING=80
|
||||
# CONNECT_TIMEOUT = 10
|
||||
# POOL_TIMEOUT = 10
|
||||
|
||||
# genshin.py 缓存配置 可选配置项
|
||||
# GENSHIN_TTL = 3600
|
||||
|
||||
# mtp 客户端 可选配置项
|
||||
# API_ID=12345
|
||||
# API_HASH="abcdefg"
|
||||
|
@ -63,6 +63,8 @@ class BotConfig(BaseSettings):
|
||||
connect_timeout: Optional[float] = None
|
||||
pool_timeout: Optional[float] = None
|
||||
|
||||
genshin_ttl: Optional[int] = None
|
||||
|
||||
enka_network_api_agent: str = ""
|
||||
pass_challenge_api: str = ""
|
||||
pass_challenge_app_key: str = ""
|
||||
|
@ -18,6 +18,7 @@ from typing_extensions import ParamSpec
|
||||
|
||||
from core.base.redisdb import RedisDB
|
||||
from core.bot import bot
|
||||
from core.config import config
|
||||
from core.cookies.services import CookiesService, PublicCookiesService
|
||||
from core.error import ServiceNotFoundError
|
||||
from core.user.services import UserService
|
||||
@ -47,8 +48,8 @@ public_cookies_service = cast(PublicCookiesService, public_cookies_service)
|
||||
redis_db = bot.services.get(RedisDB)
|
||||
redis_db = cast(RedisDB, redis_db)
|
||||
genshin_cache: Optional[genshin.RedisCache] = None
|
||||
if redis_db:
|
||||
genshin_cache = genshin.RedisCache(redis_db.client)
|
||||
if redis_db and config.genshin_ttl:
|
||||
genshin_cache = genshin.RedisCache(redis_db.client, ttl=config.genshin_ttl)
|
||||
|
||||
REGION_MAP = {
|
||||
"1": RegionEnum.HYPERION,
|
||||
|
Loading…
Reference in New Issue
Block a user