入群通知,使用富文本内容
This commit is contained in:
@@ -60,6 +60,35 @@ class MessageUtil:
|
||||
self.LOG.info(f"Sending file to {receiver}: {file_path}")
|
||||
self.wcf.send_file(file_path, receiver)
|
||||
|
||||
def send_rich_text(self, name: str, account: str, title: str, digest: str, url: str, thumburl: str, receiver: str) -> int:
|
||||
"""
|
||||
发送富文本消息
|
||||
|
||||
卡片样式:
|
||||
|-------------------------------------|
|
||||
|title, 最长两行 |
|
||||
|(长标题, 标题短的话这行没有) |
|
||||
|digest, 最多三行,会占位 |--------|
|
||||
|digest, 最多三行,会占位 |thumburl|
|
||||
|digest, 最多三行,会占位 |--------|
|
||||
|(account logo) name |
|
||||
|-------------------------------------|
|
||||
|
||||
:param name: 左下显示的名字
|
||||
:param account: 填公众号 id 可以显示对应的头像(gh_ 开头的)
|
||||
:param title: 标题,最多两行
|
||||
:param digest: 摘要,三行
|
||||
:param url: 点击后跳转的链接
|
||||
:param thumburl: 缩略图的链接
|
||||
:param receiver: 接收人, wxid 或者 roomid
|
||||
:return: 0 为成功,其他失败
|
||||
"""
|
||||
# 风控处理,随机延迟发送,解决群消息高频发送导致的微信风险
|
||||
time.sleep(random.uniform(0.5, 1.5))
|
||||
|
||||
self.LOG.info(f"Sending rich text to {receiver}: {title}")
|
||||
return self.wcf.send_rich_text(name, account, title, digest, url, thumburl, receiver)
|
||||
|
||||
def update_contacts(self, contacts: dict) -> None:
|
||||
"""
|
||||
更新联系人字典
|
||||
|
||||
Reference in New Issue
Block a user