fix(simplex): use structured /_send for DM text messages to prevent silent drops

This commit is contained in:
liuhao1024
2026-06-12 03:12:06 +08:00
committed by kshitij
parent 077e6170a9
commit 3a04d9c4d7
2 changed files with 37 additions and 6 deletions
+8 -6
View File
@@ -830,15 +830,17 @@ class SimplexAdapter(BasePlatformAdapter):
if content:
corr_id = self._make_corr_id()
# Structured form: addresses by ID, and json.dumps escapes
# newlines + special chars correctly. The bare @id text
# syntax is unreliable for DMs — the daemon silently drops
# messages when it cannot resolve the display name.
composed = json.dumps(
[{"msgContent": {"type": "text", "text": content}}]
)
if chat_id.startswith("group:"):
# Structured form: addresses by numeric ID, and json.dumps
# escapes newlines + special chars correctly.
composed = json.dumps(
[{"msgContent": {"type": "text", "text": content}}]
)
cmd_str = f"/_send #{chat_id[6:]} json {composed}"
else:
cmd_str = f"@{chat_id} {content}"
cmd_str = f"/_send @{chat_id} json {composed}"
await self._send_ws({"corrId": corr_id, "cmd": cmd_str})