fix wechat message

This commit is contained in:
jxxghp
2023-06-10 23:07:26 +08:00
parent 2a6b6c5c80
commit bfa78c5afb
7 changed files with 34 additions and 9 deletions

View File

@ -114,15 +114,18 @@ class TelegramModule(_ModuleBase):
return self.telegram.send_meidas_msg(title=title, medias=items, userid=userid)
def post_torrents_message(self, title: str, items: List[Context],
mediainfo: MediaInfo = None,
userid: Union[str, int] = None) -> Optional[bool]:
"""
发送种子信息选择列表
:param title: 标题
:param items: 消息列表
:param mediainfo: 媒体信息
:param userid: 用户ID
:return: 成功或失败
"""
return self.telegram.send_torrents_msg(title=title, torrents=items, userid=userid)
return self.telegram.send_torrents_msg(title=title, torrents=items,
mediainfo=mediainfo, userid=userid)
def register_commands(self, commands: dict):
"""

View File

@ -126,7 +126,9 @@ class Telegram(metaclass=Singleton):
logger.error(f"发送消息失败:{msg_e}")
return False
def send_torrents_msg(self, torrents: List[Context], userid: str = "", title: str = "") -> Optional[bool]:
def send_torrents_msg(self, torrents: List[Context],
mediainfo: MediaInfo = None,
userid: str = "", title: str = "") -> Optional[bool]:
"""
发送列表消息
"""
@ -151,7 +153,8 @@ class Telegram(metaclass=Singleton):
else:
chat_id = self._telegram_chat_id
return self.__send_request(userid=chat_id, caption=caption)
return self.__send_request(userid=chat_id, caption=caption,
image=mediainfo.get_message_image())
except Exception as msg_e:
logger.error(f"发送消息失败:{msg_e}")