Fix creating ads
This commit is contained in:
parent
cd0a772e65
commit
dc1b11bf1e
|
@ -37,22 +37,31 @@ class IRCCommands(object):
|
|||
Post an ad on AgoraDesk with the given country and currency code.
|
||||
"""
|
||||
if length == 4:
|
||||
if spl[1] not in loads(settings.Agora.AssetList):
|
||||
msg(f"Not a valid asset: {spl[1]}")
|
||||
asset = spl[1]
|
||||
country = spl[2]
|
||||
currency = spl[3]
|
||||
if asset not in loads(settings.Agora.AssetList):
|
||||
msg(f"Not a valid asset: {asset}")
|
||||
return
|
||||
posted = agora.create_ad(spl[1], spl[2], spl[3], "REVOLUT")
|
||||
_, account_info = tx.markets.get_valid_account_details()
|
||||
posted = agora.create_ad(asset, country, currency, "NATIONAL_BANK", payment_details=account_info[currency])
|
||||
if posted["success"]:
|
||||
msg(f"{posted['response']['data']['message']}: {posted['response']['data']['ad_id']}")
|
||||
else:
|
||||
msg(dumps(posted["response"]))
|
||||
elif length == 5:
|
||||
if spl[1] not in loads(settings.Agora.AssetList):
|
||||
msg(f"Not a valid asset: {spl[1]}")
|
||||
asset = spl[1]
|
||||
country = spl[2]
|
||||
currency = spl[3]
|
||||
provider = spl[4]
|
||||
if asset not in loads(settings.Agora.AssetList):
|
||||
msg(f"Not a valid asset: {asset}")
|
||||
return
|
||||
if spl[4] not in loads(settings.Agora.ProviderList):
|
||||
msg(f"Not a valid provider: {spl[4]}")
|
||||
if provider not in loads(settings.Agora.ProviderList):
|
||||
msg(f"Not a valid provider: {provider}")
|
||||
return
|
||||
posted = agora.create_ad(spl[1], spl[2], spl[3], spl[4])
|
||||
_, account_info = tx.markets.get_valid_account_details()
|
||||
posted = agora.create_ad(asset, country, currency, provider, payment_details=account_info[currency])
|
||||
if posted["success"]:
|
||||
msg(f"{posted['response']['data']['message']}: {posted['response']['data']['ad_id']}")
|
||||
else:
|
||||
|
@ -305,10 +314,10 @@ class IRCCommands(object):
|
|||
for ad in rtrn[currency]:
|
||||
msg(f"({ad[0]}) {ad[1]} {ad[2]} {ad[3]} {ad[4]} {ad[5]} {ad[6]}")
|
||||
|
||||
class apubads(object):
|
||||
name = "apubads"
|
||||
class lpubads(object):
|
||||
name = "lpubads"
|
||||
authed = True
|
||||
helptext = "View public adverts for LocalBitcoins. Usage: pubads <XMR/BTC> <currency> [<provider,...>]"
|
||||
helptext = "View public adverts for LocalBitcoins. Usage: lpubads <XMR/BTC> <currency> [<provider,...>]"
|
||||
|
||||
@staticmethod
|
||||
def run(cmd, spl, length, authed, msg, agora, tx, ux):
|
||||
|
|
Loading…
Reference in New Issue