Add commands to manage references

This commit is contained in:
Mark Veidemanis 2021-12-28 23:57:25 +00:00
parent 70682d1a9c
commit 6743bd5106
Signed by: m
GPG Key ID: 5ACFCEED46C0904F
1 changed files with 34 additions and 0 deletions

View File

@ -155,3 +155,37 @@ class IRCCommands(object):
full_msg = " ".join(spl[2:])
rtrn = agora.agora.contact_message_post(spl[1], full_msg)
msg(f"Sent {full_msg} to {spl[1]}: {rtrn}")
class refs(object):
name = "refs"
authed = True
@staticmethod
def run(cmd, spl, length, authed, msg, agora, revolut, tx):
msg(f"References: {', '.join(tx.get_refs())}")
class ref(object):
name = "ref"
authed = True
@staticmethod
def run(cmd, spl, length, authed, msg, agora, revolut, tx):
if length == 2:
ref_data = tx.get_ref(spl[1])
if not ref_data:
msg("No such reference: {spl[1]}")
msg(f"{spl[1]}: {dumps(ref_data)}")
class delete(object):
name = "del"
authed = True
@staticmethod
def run(cmd, spl, length, authed, msg, agora, revolut, tx):
if length == 2:
ref_data = tx.get_ref(spl[1])
if not ref_data:
msg(f"No such reference: {spl[1]}")
return
tx.del_ref(spl[1])
msg(f"Deleted reference: {spl[1]}")