diff --git a/handler/commands.py b/handler/commands.py index 722ea28..dee12b3 100644 --- a/handler/commands.py +++ b/handler/commands.py @@ -13,8 +13,12 @@ class IRCCommands(object): Get details of open trades and post on IRC. """ trades = agora.dashboard(send_irc=False) + if trades is False: + msg("Error getting trades.") + return if not trades: msg("No open trades.") + return for trade_id in trades: msg(trade_id) @@ -44,8 +48,12 @@ class IRCCommands(object): """ if length == 1: messages = agora.get_all_messages(send_irc=False) + if messages is False: + msg("Error getting messages.") + return if not messages: msg("No messages.") + return for message_id in messages: for message in messages[message_id]: msg(f"{message_id}: {message}") @@ -96,9 +104,15 @@ class IRCCommands(object): @staticmethod def run(cmd, spl, length, authed, msg, agora, revolut, tx): accounts = revolut.accounts() + accounts_posted = 0 + if accounts is None: + msg("Error getting accounts.") for account in accounts: if account["balance"] > 0: msg(f"{account['name']} {account['currency']}: {account['balance']}") + accounts_posted += 1 + if accounts_posted == 0: + msg("No accounts with balances.") class total(object): name = "total"