mirror of
https://github.com/langbot-app/LangBot.git
synced 2026-08-23 18:47:15 +00:00
新增小程序转发
This commit is contained in:
@@ -47,6 +47,8 @@ class GewechatMessageConverter(adapter.MessageConverter):
|
|||||||
if not component.url:
|
if not component.url:
|
||||||
pass
|
pass
|
||||||
content_list.append({"type": "image", "image": component.url})
|
content_list.append({"type": "image", "image": component.url})
|
||||||
|
elif isinstance(component, platform_message.MiniPrograms):
|
||||||
|
content_list.append({"type": 'MiniPrograms', 'xml_data': component.xml_data, 'image_url': component.image_url})
|
||||||
|
|
||||||
|
|
||||||
elif isinstance(component, platform_message.Voice):
|
elif isinstance(component, platform_message.Voice):
|
||||||
@@ -361,6 +363,8 @@ class GeWeChatAdapter(adapter.MessagePlatformAdapter):
|
|||||||
elif msg['type'] == 'image':
|
elif msg['type'] == 'image':
|
||||||
|
|
||||||
self.bot.post_image(app_id=self.config['app_id'], to_wxid=target_id, img_url=msg["image"])
|
self.bot.post_image(app_id=self.config['app_id'], to_wxid=target_id, img_url=msg["image"])
|
||||||
|
elif msg['type'] == 'MiniPrograms':
|
||||||
|
self.bot.forward_mini_app(app_id=self.config['app_id'], to_wxid=target_id, xml=msg['xml_data'], cover_img_url=msg['image_url'])
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -643,6 +643,14 @@ class Unknown(MessageComponent):
|
|||||||
text: str
|
text: str
|
||||||
"""文本。"""
|
"""文本。"""
|
||||||
|
|
||||||
|
class MiniPrograms(MessageComponent):
|
||||||
|
"""小程序?"""
|
||||||
|
type: str = 'MiniPrograms'
|
||||||
|
"""xml数据"""
|
||||||
|
xml_data: str
|
||||||
|
"""首页图片"""
|
||||||
|
image_url: typing.Optional[str] = None
|
||||||
|
|
||||||
|
|
||||||
class Voice(MessageComponent):
|
class Voice(MessageComponent):
|
||||||
"""语音。"""
|
"""语音。"""
|
||||||
|
|||||||
Reference in New Issue
Block a user