mirror of
https://github.com/meshcore-dev/meshcore_py.git
synced 2026-04-20 22:13:49 +00:00
ensure contacts before setting up events
This commit is contained in:
parent
2b32564ad2
commit
1a0203067e
2 changed files with 3 additions and 4 deletions
|
|
@ -29,6 +29,7 @@ async def main () :
|
|||
args = parser.parse_args()
|
||||
|
||||
mc = await MeshCore.create_ble(args.addr)
|
||||
await mc.ensure_contacts()
|
||||
|
||||
# Subscribe to private messages
|
||||
private_subscription = mc.subscribe(EventType.CONTACT_MSG_RECV, handle_message)
|
||||
|
|
@ -38,8 +39,6 @@ async def main () :
|
|||
|
||||
await mc.start_auto_message_fetching()
|
||||
|
||||
await mc.ensure_contacts()
|
||||
|
||||
contact = mc.get_contact_by_name(args.dest)
|
||||
if contact is None:
|
||||
print(f"Contact '{DEST}' not found in contacts.")
|
||||
|
|
|
|||
|
|
@ -32,6 +32,8 @@ async def main () :
|
|||
|
||||
mc = await MeshCore.create_tcp(args.addr, args.port)
|
||||
|
||||
await mc.ensure_contacts()
|
||||
|
||||
# Subscribe to private messages
|
||||
private_subscription = mc.subscribe(EventType.CONTACT_MSG_RECV, handle_message)
|
||||
|
||||
|
|
@ -40,8 +42,6 @@ async def main () :
|
|||
|
||||
await mc.start_auto_message_fetching()
|
||||
|
||||
await mc.ensure_contacts()
|
||||
|
||||
contact = mc.get_contact_by_name(args.dest)
|
||||
if contact is None:
|
||||
print(f"Contact '{DEST}' not found in contacts.")
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue