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.
|
Post an ad on AgoraDesk with the given country and currency code.
|
||||||
"""
|
"""
|
||||||
if length == 4:
|
if length == 4:
|
||||||
if spl[1] not in loads(settings.Agora.AssetList):
|
asset = spl[1]
|
||||||
msg(f"Not a valid 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
|
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"]:
|
if posted["success"]:
|
||||||
msg(f"{posted['response']['data']['message']}: {posted['response']['data']['ad_id']}")
|
msg(f"{posted['response']['data']['message']}: {posted['response']['data']['ad_id']}")
|
||||||
else:
|
else:
|
||||||
msg(dumps(posted["response"]))
|
msg(dumps(posted["response"]))
|
||||||
elif length == 5:
|
elif length == 5:
|
||||||
if spl[1] not in loads(settings.Agora.AssetList):
|
asset = spl[1]
|
||||||
msg(f"Not a valid 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
|
return
|
||||||
if spl[4] not in loads(settings.Agora.ProviderList):
|
if provider not in loads(settings.Agora.ProviderList):
|
||||||
msg(f"Not a valid provider: {spl[4]}")
|
msg(f"Not a valid provider: {provider}")
|
||||||
return
|
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"]:
|
if posted["success"]:
|
||||||
msg(f"{posted['response']['data']['message']}: {posted['response']['data']['ad_id']}")
|
msg(f"{posted['response']['data']['message']}: {posted['response']['data']['ad_id']}")
|
||||||
else:
|
else:
|
||||||
|
@ -305,10 +314,10 @@ class IRCCommands(object):
|
||||||
for ad in rtrn[currency]:
|
for ad in rtrn[currency]:
|
||||||
msg(f"({ad[0]}) {ad[1]} {ad[2]} {ad[3]} {ad[4]} {ad[5]} {ad[6]}")
|
msg(f"({ad[0]}) {ad[1]} {ad[2]} {ad[3]} {ad[4]} {ad[5]} {ad[6]}")
|
||||||
|
|
||||||
class apubads(object):
|
class lpubads(object):
|
||||||
name = "apubads"
|
name = "lpubads"
|
||||||
authed = True
|
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
|
@staticmethod
|
||||||
def run(cmd, spl, length, authed, msg, agora, tx, ux):
|
def run(cmd, spl, length, authed, msg, agora, tx, ux):
|
||||||
|
|
Loading…
Reference in New Issue