From d060120c9bfce5cc58e67b657a076fdad9d68939 Mon Sep 17 00:00:00 2001 From: Mark Veidemanis Date: Thu, 30 Dec 2021 14:15:34 +0000 Subject: [PATCH] Implement nuke command to remove all ads --- handler/commands.py | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/handler/commands.py b/handler/commands.py index e4a00b9..b481069 100644 --- a/handler/commands.py +++ b/handler/commands.py @@ -60,6 +60,10 @@ class IRCCommands(object): msg("---") elif length == 2: + tx = tx.ref_to_tx(spl[1]) + if not tx: + msg(f"No such reference: {spl[1]}") + return messages = agora.get_messages(spl[1], send_irc=False) if not messages: msg("No messages.") @@ -74,7 +78,10 @@ class IRCCommands(object): def run(cmd, spl, length, authed, msg, agora, revolut, tx): # Distribute out our ad to all countries in the config for x in agora.dist_countries(): - msg(dumps(x)) + if x["success"]: + msg(f"{x['response']['data']['message']}: {x['response']['data']['ad_id']}") + else: + msg(x["response"]["data"]["message"]) class find(object): name = "find" @@ -212,3 +219,12 @@ class IRCCommands(object): return rtrn = agora.release_funds(tx) msg(dumps(rtrn)) + + class nuke(object): + name = "nuke" + authed = True + + @staticmethod + def run(cmd, spl, length, authed, msg, agora, revolut, tx): + rtrn = agora.nuke_ads() + msg(dumps(rtrn))