Add commands to manage references
This commit is contained in:
parent
70682d1a9c
commit
6743bd5106
|
@ -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]}")
|
||||
|
|
Loading…
Reference in New Issue