mirror of
https://github.com/meshcore-dev/meshcore_py.git
synced 2026-04-20 22:13:49 +00:00
Added contact based dest
This commit is contained in:
parent
1a9f6d1024
commit
a1fb931200
5 changed files with 94 additions and 26 deletions
|
|
@ -38,7 +38,7 @@ async def main():
|
|||
# Send the message and get the MSG_SENT event
|
||||
print(f"Sending message: '{args.message}'")
|
||||
send_result = await mc.commands.send_msg(
|
||||
bytes.fromhex(contact["public_key"])[0:6],
|
||||
contact,
|
||||
args.message
|
||||
)
|
||||
|
||||
|
|
|
|||
|
|
@ -16,7 +16,10 @@ async def main () :
|
|||
await mc.commands.get_contacts()
|
||||
repeater = mc.get_contact_by_name(REPEATER)
|
||||
|
||||
await mc.commands.send_login(bytes.fromhex(repeater["public_key"]), PASSWORD)
|
||||
if repeater is None:
|
||||
print(f"Repeater '{REPEATER}' not found in contacts.")
|
||||
return
|
||||
await mc.commands.send_login(repeater, PASSWORD)
|
||||
|
||||
print("Login sent ... awaiting")
|
||||
|
||||
|
|
|
|||
|
|
@ -17,6 +17,10 @@ async def main () :
|
|||
await mc.connect()
|
||||
|
||||
await mc.ensure_contacts()
|
||||
await mc.commands.send_msg(bytes.fromhex(mc.get_contact_by_name(DEST)["public_key"])[0:6],MSG)
|
||||
contact = mc.get_contact_by_name(DEST)
|
||||
if contact is None:
|
||||
print(f"Contact '{DEST}' not found in contacts.")
|
||||
return
|
||||
await mc.commands.send_msg(contact ,MSG)
|
||||
|
||||
asyncio.run(main())
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue