From f8521eced3db41b130b0efe0b90c46053a35b31f Mon Sep 17 00:00:00 2001 From: Mark Veidemanis Date: Tue, 3 May 2022 08:48:58 +0100 Subject: [PATCH] Port trades command to async --- handler/ux/commands.py | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/handler/ux/commands.py b/handler/ux/commands.py index 66c5b65..6fd6887 100644 --- a/handler/ux/commands.py +++ b/handler/ux/commands.py @@ -7,6 +7,14 @@ from settings import settings class GenericCommands(object): class trades(object): + @staticmethod + def got_trades(trades, msg): + if not trades: + msg("No open trades.") + return + for trade_id in trades: + msg(trade_id) + @staticmethod def run(cmd, spl, length, authed, msg, agora, tx, ux, caller): """ @@ -14,12 +22,7 @@ class GenericCommands(object): """ trades = caller.get_dashboard_irc() - - if not trades: - msg("No open trades.") - return - for trade_id in trades: - msg(trade_id) + trades.addCallback(GenericCommands.trades.got_trades, msg) class create(object): @staticmethod