Fix pubads command after ads refactor

This commit is contained in:
Mark Veidemanis 2022-02-12 15:12:52 +00:00
parent 80916648e3
commit aa4b623ae6
Signed by: m
GPG Key ID: 5ACFCEED46C0904F
2 changed files with 11 additions and 9 deletions

View File

@ -429,7 +429,7 @@ class Agora(object):
self.slow_ad_update(to_update)
@handle_exceptions
def get_all_public_ads(self, assets=None):
def get_all_public_ads(self, assets=None, currencies=None, providers=None):
"""
Get all public ads for our listed currencies.
:return: dict of public ads keyed by currency
@ -444,7 +444,9 @@ class Agora(object):
if not assets:
assets = self.markets.get_all_assets()
# Get all currencies we have ads for, deduplicated
if not currencies:
currencies = self.markets.get_all_currencies()
if not providers:
providers = self.markets.get_all_providers()
# We want to get the ads for each of these currencies and return the result

View File

@ -331,9 +331,9 @@ class IRCCommands(object):
msg(f"Not a valid asset: {spl[1]}")
return
currency = spl[2]
rtrn = agora.wrap_public_ads(asset, currency)
for ad in rtrn:
msg(f"({ad[0]}) {ad[1]} {ad[2]} {ad[4]} {ad[5]}")
rtrn = agora.get_all_public_ads([asset], [currency])
for ad in rtrn[currency]:
msg(f"({ad[0]}) {ad[1]} {ad[2]} {ad[3]} {ad[4]} {ad[5]} {ad[6]}")
elif length == 4:
asset = spl[1]
if asset not in loads(settings.Agora.AssetList):
@ -341,9 +341,9 @@ class IRCCommands(object):
return
providers = spl[3].split(",")
currency = spl[2]
rtrn = agora.wrap_public_ads(asset, currency, providers)
for ad in rtrn:
msg(f"({ad[0]}) {ad[1]} {ad[2]} {ad[3]} {ad[4]} {ad[5]}")
rtrn = agora.get_all_public_ads([asset], [currency], providers)
for ad in rtrn[currency]:
msg(f"({ad[0]}) {ad[1]} {ad[2]} {ad[3]} {ad[4]} {ad[5]} {ad[6]}")
class cheat(object):
name = "cheat"