LinkMessage
链接消息,继承自 Message。公众号文章、网页分享等。
属性
| 属性 | 类型 | 说明 |
|---|---|---|
content | str | 链接标题文本 |
sender | str | 发送者 |
source | Source | 消息来源 |
title | str | 链接标题 |
link_source | str | 链接来源(如公众号名称) |
type_label | str | 固定为 "链接消息" |
支持的操作
view、hover、scroll_to_visible、refresh、quote、collect、forward、revoke、delete
示例
python
from pywxauto import Weixin, Event
wx = Weixin()
@wx.on(Event.LINK)
def on_link(weixin, chat, message):
print(f"收到链接: {message.title}")
print(f" 来源: {message.link_source}")
# 点击打开链接
message.view()