Implement propagating account data to ads

This commit is contained in:
2022-03-08 20:42:47 +00:00
parent aefa6c58a4
commit f2c9725fcb
9 changed files with 264 additions and 123 deletions

View File

@@ -477,7 +477,6 @@ class IRCCommands(object):
account_id = spl[2]
transactions = tx.sinks.truelayer.get_transactions(account, account_id)
for transaction in transactions:
print(transaction)
txid = transaction["transaction_id"]
ptxid = transaction["provider_transaction_id"]
txtype = transaction["transaction_type"]
@@ -502,3 +501,31 @@ class IRCCommands(object):
msg(f"Failed to map the account")
return
msg(f"Mapped account ID {account_id} at bank {bank} to {account_name}")
class unmapped(object):
name = "unmapped"
authed = True
helptext = "Get unmapped accounts for a bank. Usage: unmapped <bank>"
@staticmethod
def run(cmd, spl, length, authed, msg, agora, tx, ux):
if length == 2:
bank = spl[1]
accounts_active = []
for bank, accounts in tx.sinks.truelayer.banks.items():
for account in accounts:
accounts_active.append(account)
accounts_all = tx.sinks.truelayer.get_accounts(bank)
accounts_unmapped = [x["account_id"] for x in accounts_all["results"] if x["account_id"] not in accounts_active]
msg(f"Unmapped accounts: {', '.join(accounts_unmapped)}")
class distdetails(object):
name = "distdetails"
authed = True
helptext = "Distribute account details among all ads."
@staticmethod
def run(cmd, spl, length, authed, msg, agora, tx, ux):
currencies = tx.sinks.currencies
tx.markets.distribute_account_details()
msg(f"Distributing account details for currencies: {', '.join(currencies)}")

View File

@@ -118,6 +118,7 @@ class IRCBot(irc.IRCClient):
:type channel: string
"""
self.agora.setup_loop()
self.sinks.__irc_started__()
self.log.info(f"Joined channel {channel}")
def privmsg(self, user, channel, msg):