This commit is contained in:
jxxghp
2025-06-12 18:41:46 +08:00
parent 86ab2c8c05
commit 23b981c5ac
2 changed files with 8 additions and 10 deletions
-4
View File
@@ -124,8 +124,6 @@ class ConfigModel(BaseModel):
ALIPAN_APP_ID: str = "ac1bf04dc9fd4d9aaabb65b4a668d403" ALIPAN_APP_ID: str = "ac1bf04dc9fd4d9aaabb65b4a668d403"
# 元数据识别缓存过期时间(小时) # 元数据识别缓存过期时间(小时)
META_CACHE_EXPIRE: int = 0 META_CACHE_EXPIRE: int = 0
# 电视剧动漫的分类genre_ids
ANIME_GENREIDS: List[int] = [16]
# 用户认证站点 # 用户认证站点
AUTH_SITE: str = "" AUTH_SITE: str = ""
# 重启自动升级 # 重启自动升级
@@ -286,8 +284,6 @@ class ConfigModel(BaseModel):
DEFAULT_SUB: Optional[str] = "zh-cn" DEFAULT_SUB: Optional[str] = "zh-cn"
# Docker Client API地址 # Docker Client API地址
DOCKER_CLIENT_API: Optional[str] = "tcp://127.0.0.1:38379" DOCKER_CLIENT_API: Optional[str] = "tcp://127.0.0.1:38379"
# telegram bot api 地址,格式:https://api.telegram.org
TG_API_URL: Optional[str] = None
class Settings(BaseSettings, ConfigModel, LogConfigModel): class Settings(BaseSettings, ConfigModel, LogConfigModel):
+8 -6
View File
@@ -18,11 +18,6 @@ from app.utils.common import retry
from app.utils.http import RequestUtils from app.utils.http import RequestUtils
from app.utils.string import StringUtils from app.utils.string import StringUtils
if settings.TG_API_URL:
apihelper.API_URL = urljoin(settings.TG_API_URL, '/bot{0}/{1}')
apihelper.FILE_URL = urljoin(settings.TG_API_URL, '/file/bot{0}/{1}')
else:
apihelper.proxy = settings.PROXY
class Telegram: class Telegram:
_ds_url = f"http://127.0.0.1:{settings.PORT}/api/v1/message?token={settings.API_TOKEN}" _ds_url = f"http://127.0.0.1:{settings.PORT}/api/v1/message?token={settings.API_TOKEN}"
@@ -42,6 +37,12 @@ class Telegram:
self._telegram_chat_id = TELEGRAM_CHAT_ID self._telegram_chat_id = TELEGRAM_CHAT_ID
# 初始化机器人 # 初始化机器人
if self._telegram_token and self._telegram_chat_id: if self._telegram_token and self._telegram_chat_id:
# telegram bot api 地址,格式:https://api.telegram.org
if kwargs.get("API_URL"):
apihelper.API_URL = urljoin(kwargs["API_URL"], '/bot{0}/{1}')
apihelper.FILE_URL = urljoin(kwargs["API_URL"], '/file/bot{0}/{1}')
else:
apihelper.proxy = settings.PROXY
# bot # bot
_bot = telebot.TeleBot(self._telegram_token, parse_mode="Markdown") _bot = telebot.TeleBot(self._telegram_token, parse_mode="Markdown")
# 记录句柄 # 记录句柄
@@ -161,7 +162,8 @@ class Telegram:
return False return False
def send_torrents_msg(self, torrents: List[Context], def send_torrents_msg(self, torrents: List[Context],
userid: Optional[str] = None, title: Optional[str] = None, link: Optional[str] = None) -> Optional[bool]: userid: Optional[str] = None, title: Optional[str] = None,
link: Optional[str] = None) -> Optional[bool]:
""" """
发送列表消息 发送列表消息
""" """