Make commands async and improve error handling
This commit is contained in:
@@ -887,15 +887,19 @@ class IRCCommands(object):
|
||||
authed = True
|
||||
helptext = "Enable an account_id at a bank for use in Nordigen. Usage: nmapaccount <account_id>"
|
||||
|
||||
@staticmethod
|
||||
def got_map_account(account_name, account_id, msg):
|
||||
if not account_name:
|
||||
msg(f"Failed to map the account")
|
||||
return
|
||||
msg(f"Mapped account ID {account_id} to {account_name}")
|
||||
|
||||
@staticmethod
|
||||
def run(cmd, spl, length, authed, msg, agora, tx, ux):
|
||||
if length == 2:
|
||||
account_id = spl[1]
|
||||
account_name = tx.sinks.nordigen.map_account(account_id)
|
||||
if not account_name:
|
||||
msg(f"Failed to map the account")
|
||||
return
|
||||
msg(f"Mapped account ID {account_id} to {account_name}")
|
||||
c = tx.sinks.nordigen.map_account(account_id)
|
||||
c.addCallback(IRCCommands.nmapaccount.got_map_account, account_id, msg)
|
||||
|
||||
class nunmapaccount(object):
|
||||
name = "nunmapaccount"
|
||||
|
||||
Reference in New Issue
Block a user