mirror of
https://github.com/meshcore-dev/meshcore-cli.git
synced 2026-04-20 22:13:48 +00:00
use send_msg_reliable when sending from chat
This commit is contained in:
parent
579c2bbdbd
commit
97f85428ef
1 changed files with 11 additions and 4 deletions
|
|
@ -857,10 +857,17 @@ async def send_msg (mc, contact, msg) :
|
|||
return res
|
||||
|
||||
async def msg_ack (mc, contact, msg) :
|
||||
result = await send_msg(mc, contact, msg)
|
||||
if result.type == EventType.ERROR:
|
||||
print(f"⚠️ Failed to send message: {result.payload}")
|
||||
return False
|
||||
res = await mc.commands.send_msg_reliable(contact, msg)
|
||||
if not res is None and not res.type == EventType.ERROR:
|
||||
res.payload["expected_ack"] = res.payload["expected_ack"].hex()
|
||||
sent = res.payload.copy()
|
||||
sent["type"] = "SENT_MSG"
|
||||
sent["name"] = contact["adv_name"]
|
||||
sent["text"] = msg
|
||||
sent["txt_type"] = 0
|
||||
sent["name"] = mc.self_info['name']
|
||||
await log_message(mc, sent)
|
||||
return not res is None
|
||||
|
||||
exp_ack = result.payload["expected_ack"]
|
||||
timeout = result.payload["suggested_timeout"] / 1000 * 1.2 if not "timeout" in contact or contact['timeout']==0 else contact["timeout"]
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue