mirror of
https://github.com/jxxghp/MoviePilot.git
synced 2026-03-20 03:57:30 +08:00
fix #4434
This commit is contained in:
@@ -18,11 +18,6 @@ from app.utils.common import retry
|
||||
from app.utils.http import RequestUtils
|
||||
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:
|
||||
_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
|
||||
# 初始化机器人
|
||||
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 = telebot.TeleBot(self._telegram_token, parse_mode="Markdown")
|
||||
# 记录句柄
|
||||
@@ -161,7 +162,8 @@ class Telegram:
|
||||
return False
|
||||
|
||||
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]:
|
||||
"""
|
||||
发送列表消息
|
||||
"""
|
||||
|
||||
Reference in New Issue
Block a user