Move stuff in silly places

This commit is contained in:
2022-05-05 18:16:56 +01:00
parent 22520c8224
commit 38caba7d2b
16 changed files with 1382 additions and 53 deletions

View File

@@ -40,5 +40,6 @@ class UX(object):
"irc": self.irc,
"notify": self.notify,
"verify": self.verify,
"antifraud": self.antifraud,
}
util.xmerge_attrs(init_map)

View File

@@ -80,17 +80,8 @@ class GenericCommands(object):
Get all messages for all open trades or a given trade.
"""
if length == 1:
messages = caller.get_recent_messages()
if messages is False:
msg("Error getting messages.")
return
if not messages:
msg("No messages.")
return
for reference in messages:
for message in messages[reference]:
msg(f"{reference}: {message[0]} {message[1]}")
msg("---")
m = caller.api.recent_messages()
m.addCallback(caller.got_recent_messages)
elif length == 2:
tx = tx.ref_to_tx(spl[1])
@@ -392,7 +383,7 @@ class IRCCommands(object):
@staticmethod
def run(cmd, spl, length, authed, msg, agora, tx, ux):
totals_all = tx.get_total()
totals_all = tx.money.get_total()
totals = totals_all[0]
wallets = totals_all[1]
msg(f"Totals: SEK: {totals[0]} | USD: {totals[1]} | GBP: {totals[2]}")
@@ -674,7 +665,7 @@ class IRCCommands(object):
@staticmethod
def run(cmd, spl, length, authed, msg, agora, tx, ux):
remaining = tx.get_remaining()
remaining = tx.money.get_remaining()
msg(f"Remaining: {remaining}USD")
class total_remaining(object):
@@ -684,7 +675,7 @@ class IRCCommands(object):
@staticmethod
def run(cmd, spl, length, authed, msg, agora, tx, ux):
remaining = tx.get_total_remaining()
remaining = tx.money.get_total_remaining()
msg(f"Total remaining: {remaining}USD")
class tradetotal(object):
@@ -694,7 +685,7 @@ class IRCCommands(object):
@staticmethod
def run(cmd, spl, length, authed, msg, agora, tx, ux):
total = tx.get_open_trades_usd()
total = tx.money.get_open_trades_usd()
msg(f"Total trades: {total}USD")
class dollar(object):
@@ -704,7 +695,7 @@ class IRCCommands(object):
@staticmethod
def run(cmd, spl, length, authed, msg, agora, tx, ux):
total = tx.get_total_with_trades()
total = tx.money.get_total_with_trades()
msg(f"${total}")
class profit(object):
@@ -985,6 +976,6 @@ class IRCCommands(object):
if length == 3:
platform = spl[1]
username = spl[2]
uid = tx.create_uid(platform, username)
uid = tx.ux.verify.create_uid(platform, username)
first, last = tx.ux.verify.get_external_user_id_details(uid)
msg(f"Name: {first} {last}")

View File

@@ -15,11 +15,25 @@ class Verify(util.Base):
Class to handle user verification.
"""
def create_uid(self, platform, username):
return f"{platform}|{username}"
def get_uid(self, external_user_id):
"""
Get the platform and username from the external user ID.
"""
spl = external_user_id.split("|")
if not len(spl) == 2:
self.log.error(f"Split invalid, cannot get customer: {spl}")
return False
platform, username = spl
return (platform, username)
def verification_successful(self, external_user_id):
"""
Called when verification has been successfully passed.
"""
self.tx.user_verification_successful(external_user_id)
self.antifraud.user_verification_successful(external_user_id)
def update_verification_status(self, external_user_id, review_status, review_answer=None):
"""