mirror of
https://github.com/langbot-app/LangBot.git
synced 2026-06-10 07:46:02 +00:00
Compare commits
6 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
11b1110eed | ||
|
|
682b897e21 | ||
|
|
998ad7623c | ||
|
|
4f1db33abc | ||
|
|
ca6cb60bdd | ||
|
|
133e48a5a9 |
@@ -43,8 +43,11 @@ class GewechatMessageConverter(adapter.MessageConverter):
|
|||||||
elif isinstance(component, platform_message.Plain):
|
elif isinstance(component, platform_message.Plain):
|
||||||
content_list.append({"type": "text", "content": component.text})
|
content_list.append({"type": "text", "content": component.text})
|
||||||
elif isinstance(component, platform_message.Image):
|
elif isinstance(component, platform_message.Image):
|
||||||
|
content_list.append({"type": "image", "url": component.url})
|
||||||
# content_list.append({"type": "image", "image_id": component.image_id})
|
# content_list.append({"type": "image", "image_id": component.image_id})
|
||||||
pass
|
#pass
|
||||||
|
elif isinstance(component, platform_message.Voice):
|
||||||
|
content_list.append({"type": "voice", "url": component.url, "length": component.length})
|
||||||
elif isinstance(component, platform_message.Forward):
|
elif isinstance(component, platform_message.Forward):
|
||||||
for node in component.node_list:
|
for node in component.node_list:
|
||||||
content_list.extend(await GewechatMessageConverter.yiri2target(node.message_chain))
|
content_list.extend(await GewechatMessageConverter.yiri2target(node.message_chain))
|
||||||
@@ -103,7 +106,11 @@ class GewechatMessageConverter(adapter.MessageConverter):
|
|||||||
return platform_message.MessageChain([
|
return platform_message.MessageChain([
|
||||||
platform_message.Plain(text="[图片处理失败]")
|
platform_message.Plain(text="[图片处理失败]")
|
||||||
])
|
])
|
||||||
|
elif message["Data"]["MsgType"] == 34:
|
||||||
|
audio_base64 = message["Data"]["ImgBuf"]["buffer"]
|
||||||
|
return platform_message.MessageChain(
|
||||||
|
[platform_message.Voice(base64=f"data:audio/silk;base64,{audio_base64}")]
|
||||||
|
)
|
||||||
elif message["Data"]["MsgType"] == 49:
|
elif message["Data"]["MsgType"] == 49:
|
||||||
# 支持微信聊天记录的消息类型,将 XML 内容转换为 MessageChain 传递
|
# 支持微信聊天记录的消息类型,将 XML 内容转换为 MessageChain 传递
|
||||||
try:
|
try:
|
||||||
@@ -238,7 +245,11 @@ class GeWeChatAdapter(adapter.MessagePlatformAdapter):
|
|||||||
target_id: str,
|
target_id: str,
|
||||||
message: platform_message.MessageChain
|
message: platform_message.MessageChain
|
||||||
):
|
):
|
||||||
pass
|
geweap_msg = await GewechatMessageConverter.yiri2target(message)
|
||||||
|
|
||||||
|
for msg in geweap_msg:
|
||||||
|
if msg['type'] == 'text':
|
||||||
|
await self.bot.post_text(app_id=self.config['app_id'], to_wxid=target_id,content=msg['content'])
|
||||||
|
|
||||||
async def reply_message(
|
async def reply_message(
|
||||||
self,
|
self,
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
semantic_version = "v3.4.9.4"
|
semantic_version = "v3.4.9.5"
|
||||||
|
|
||||||
debug_mode = False
|
debug_mode = False
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user