diff --git a/handler/commands.py b/handler/commands.py index b1a924a..1730bcd 100644 --- a/handler/commands.py +++ b/handler/commands.py @@ -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]}")