bracket syntax

This commit is contained in:
Florent de Lamotte 2025-03-05 20:09:57 +01:00
parent 5c269bc662
commit c8ba400730

View file

@ -546,27 +546,22 @@ async def next_cmd(mc, cmds):
case "send" :
argnum = 2
print(await mc.send_msg(bytes.fromhex(cmds[1]), cmds[2]))
case "sendto" : # sends to a contact from name
case "msg" | "sendto" | "m"|"(" : # sends to a contact from name
argnum = 2
await mc.ensure_contacts()
print(await mc.send_msg(bytes.fromhex(mc.contacts[cmds[1]]["public_key"])[0:6],
cmds[2]))
case "msg" | "m" : # sends to a contact from name
argnum = 2
await mc.ensure_contacts()
print(await mc.send_msg(bytes.fromhex(mc.contacts[cmds[1]]["public_key"])[0:6],
cmds[2]))
case "cmd" | "c" :
case "cmd" | "c" | "[" :
argnum = 2
await mc.ensure_contacts()
print(await mc.send_cmd(bytes.fromhex(mc.contacts[cmds[1]]["public_key"])[0:6],
cmds[2]))
case "login" | "l" :
case "login" | "l" | "{" :
argnum = 2
await mc.ensure_contacts()
print(await mc.send_login(bytes.fromhex(mc.contacts[cmds[1]]["public_key"]),
cmds[2]))
case "wait_login" | "wl":
case "wait_login" | "wl"|"}":
print(await mc.wait_login())
case "req_status" | "rs" :
argnum = 1
@ -601,11 +596,11 @@ async def next_cmd(mc, cmds):
while res:
res = await mc.get_msg()
print (res)
case "wait_msg" | "wm" :
case "wait_msg" | "wm" |"]":
await mc.wait_msg()
res = await mc.get_msg()
print (res)
case "wait_ack" | "wa" :
case "wait_ack" | "wa" |")":
await mc.wait_ack()
case "infos" | "i" :
print(json.dumps(mc.self_info,indent=4))