Implement LBTC versions of each command
This commit is contained in:
parent
1c702cd755
commit
e751fcd39d
|
@ -7,11 +7,6 @@ from settings import settings
|
||||||
|
|
||||||
class GenericCommands(object):
|
class GenericCommands(object):
|
||||||
class trades(object):
|
class trades(object):
|
||||||
authed = True
|
|
||||||
platform = None
|
|
||||||
name = None
|
|
||||||
helptext = None
|
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def run(cmd, spl, length, authed, msg, agora, tx, ux, caller):
|
def run(cmd, spl, length, authed, msg, agora, tx, ux, caller):
|
||||||
"""
|
"""
|
||||||
|
@ -26,45 +21,21 @@ class GenericCommands(object):
|
||||||
for trade_id in trades:
|
for trade_id in trades:
|
||||||
msg(trade_id)
|
msg(trade_id)
|
||||||
|
|
||||||
|
|
||||||
class IRCCommands(object):
|
|
||||||
class atrades(object):
|
|
||||||
authed = True
|
|
||||||
name = "atrades"
|
|
||||||
helptext = "Get all open trades for Agora."
|
|
||||||
|
|
||||||
@staticmethod
|
|
||||||
def run(cmd, spl, length, authed, msg, agora, tx, ux):
|
|
||||||
GenericCommands.trades.run(cmd, spl, length, authed, msg, agora, tx, ux, agora)
|
|
||||||
|
|
||||||
class ltrades(GenericCommands.trades):
|
|
||||||
authed = True
|
|
||||||
name = "ltrades"
|
|
||||||
helptext = "Get all open trades for LBTC."
|
|
||||||
|
|
||||||
@staticmethod
|
|
||||||
def run(cmd, spl, length, authed, msg, agora, tx, ux):
|
|
||||||
GenericCommands.trades.run(cmd, spl, length, authed, msg, agora, tx, ux, tx.lbtc)
|
|
||||||
|
|
||||||
class create(object):
|
class create(object):
|
||||||
name = "create"
|
|
||||||
authed = True
|
|
||||||
helptext = "Create an ad. Usage: create <XMR/BTC> <country> <currency> [<provider>]"
|
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def run(cmd, spl, length, authed, msg, agora, tx, ux):
|
def run(cmd, spl, length, authed, msg, agora, tx, ux, asset_list, provider_list, caller):
|
||||||
"""
|
"""
|
||||||
Post an ad on AgoraDesk with the given country and currency code.
|
Post an ad on AgoraDesk/LBTC with the given country and currency code.
|
||||||
"""
|
"""
|
||||||
if length == 4:
|
if length == 4:
|
||||||
asset = spl[1]
|
asset = spl[1]
|
||||||
country = spl[2]
|
country = spl[2]
|
||||||
currency = spl[3]
|
currency = spl[3]
|
||||||
if asset not in loads(settings.Agora.AssetList):
|
if asset not in loads(asset_list):
|
||||||
msg(f"Not a valid asset: {asset}")
|
msg(f"Not a valid asset: {asset}")
|
||||||
return
|
return
|
||||||
_, account_info = tx.markets.get_valid_account_details()
|
_, account_info = tx.markets.get_valid_account_details()
|
||||||
posted = agora.create_ad(
|
posted = caller.create_ad(
|
||||||
asset,
|
asset,
|
||||||
country,
|
country,
|
||||||
currency,
|
currency,
|
||||||
|
@ -80,14 +51,14 @@ class IRCCommands(object):
|
||||||
country = spl[2]
|
country = spl[2]
|
||||||
currency = spl[3]
|
currency = spl[3]
|
||||||
provider = spl[4]
|
provider = spl[4]
|
||||||
if asset not in loads(settings.Agora.AssetList):
|
if asset not in loads(asset_list):
|
||||||
msg(f"Not a valid asset: {asset}")
|
msg(f"Not a valid asset: {asset}")
|
||||||
return
|
return
|
||||||
if provider not in loads(settings.Agora.ProviderList):
|
if provider not in loads(provider_list):
|
||||||
msg(f"Not a valid provider: {provider}")
|
msg(f"Not a valid provider: {provider}")
|
||||||
return
|
return
|
||||||
_, account_info = tx.markets.get_valid_account_details()
|
_, account_info = tx.markets.get_valid_account_details()
|
||||||
posted = agora.create_ad(
|
posted = caller.create_ad(
|
||||||
asset,
|
asset,
|
||||||
country,
|
country,
|
||||||
currency,
|
currency,
|
||||||
|
@ -100,17 +71,13 @@ class IRCCommands(object):
|
||||||
msg(dumps(posted["response"]))
|
msg(dumps(posted["response"]))
|
||||||
|
|
||||||
class messages(object):
|
class messages(object):
|
||||||
name = "messages"
|
|
||||||
authed = True
|
|
||||||
helptext = "Get messages. Usage: messages [<reference>]"
|
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def run(cmd, spl, length, authed, msg, agora, tx, ux):
|
def run(cmd, spl, length, authed, msg, agora, tx, ux, caller):
|
||||||
"""
|
"""
|
||||||
Get all messages for all open trades or a given trade.
|
Get all messages for all open trades or a given trade.
|
||||||
"""
|
"""
|
||||||
if length == 1:
|
if length == 1:
|
||||||
messages = agora.get_recent_messages()
|
messages = caller.get_recent_messages()
|
||||||
if messages is False:
|
if messages is False:
|
||||||
msg("Error getting messages.")
|
msg("Error getting messages.")
|
||||||
return
|
return
|
||||||
|
@ -127,59 +94,276 @@ class IRCCommands(object):
|
||||||
if not tx:
|
if not tx:
|
||||||
msg(f"No such reference: {spl[1]}")
|
msg(f"No such reference: {spl[1]}")
|
||||||
return
|
return
|
||||||
messages = agora.get_messages(spl[1], send_irc=False)
|
messages = caller.get_messages(spl[1], send_irc=False)
|
||||||
if not messages:
|
if not messages:
|
||||||
msg("No messages.")
|
msg("No messages.")
|
||||||
for message in messages:
|
for message in messages:
|
||||||
msg(f"{spl[1]}: {message}")
|
msg(f"{spl[1]}: {message}")
|
||||||
|
|
||||||
class dist(object):
|
class dist(object):
|
||||||
name = "dist"
|
|
||||||
authed = True
|
|
||||||
helptext = "Distribute all our chosen currency and country ad pairs. Usage: dist [<XMR/BTC>]"
|
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def run(cmd, spl, length, authed, msg, agora, tx, ux):
|
def run(cmd, spl, length, authed, msg, agora, tx, ux, asset_list, caller):
|
||||||
# Distribute out our ad to all countries in the config
|
# Distribute out our ad to all countries in the config
|
||||||
if length == 2:
|
if length == 2:
|
||||||
asset = spl[1]
|
asset = spl[1]
|
||||||
if asset not in loads(settings.Agora.AssetList):
|
if asset not in loads(asset_list):
|
||||||
msg(f"Not a valid asset: {spl[1]}")
|
msg(f"Not a valid asset: {spl[1]}")
|
||||||
return
|
return
|
||||||
for x in agora.dist_countries(filter_asset=asset):
|
for x in caller.dist_countries(filter_asset=asset):
|
||||||
if x["success"]:
|
if x["success"]:
|
||||||
msg(f"{x['response']['data']['message']}: {x['response']['data']['ad_id']}")
|
msg(f"{x['response']['data']['message']}: {x['response']['data']['ad_id']}")
|
||||||
else:
|
else:
|
||||||
msg(dumps(x["response"]))
|
msg(dumps(x["response"]))
|
||||||
elif length == 1:
|
elif length == 1:
|
||||||
for x in agora.dist_countries():
|
for x in caller.dist_countries():
|
||||||
if x["success"]:
|
if x["success"]:
|
||||||
msg(f"{x['response']['data']['message']}: {x['response']['data']['ad_id']}")
|
msg(f"{x['response']['data']['message']}: {x['response']['data']['ad_id']}")
|
||||||
else:
|
else:
|
||||||
msg(dumps(x["response"]))
|
msg(dumps(x["response"]))
|
||||||
|
|
||||||
class redist(object):
|
class redist(object):
|
||||||
name = "redist"
|
|
||||||
authed = True
|
|
||||||
helptext = "Update all ads with details."
|
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def run(cmd, spl, length, authed, msg, agora, tx, ux):
|
def run(cmd, spl, length, authed, msg, agora, tx, ux, caller):
|
||||||
for x in agora.redist_countries():
|
for x in caller.redist_countries():
|
||||||
if x[0]["success"]:
|
if x[0]["success"]:
|
||||||
msg(f"{x[0]['response']['data']['message']}: {x[1]}")
|
msg(f"{x[0]['response']['data']['message']}: {x[1]}")
|
||||||
else:
|
else:
|
||||||
msg(dumps(x[0]["response"]))
|
msg(dumps(x[0]["response"]))
|
||||||
|
|
||||||
class stripdupes(object):
|
class stripdupes(object):
|
||||||
name = "stripdupes"
|
@staticmethod
|
||||||
|
def run(cmd, spl, length, authed, msg, agora, tx, ux, caller):
|
||||||
|
rtrn = caller.strip_duplicate_ads()
|
||||||
|
msg(dumps(rtrn))
|
||||||
|
|
||||||
|
class message(object):
|
||||||
|
@staticmethod
|
||||||
|
def run(cmd, spl, length, authed, msg, agora, tx, ux, caller):
|
||||||
|
if length > 2:
|
||||||
|
full_msg = " ".join(spl[2:])
|
||||||
|
reference = tx.ref_to_tx(spl[1])
|
||||||
|
if not reference:
|
||||||
|
msg(f"No such reference: {spl[1]}")
|
||||||
|
return
|
||||||
|
rtrn = caller.contact_message_post(reference, full_msg)
|
||||||
|
msg(f"Sent {full_msg} to {reference}: {rtrn}")
|
||||||
|
|
||||||
|
class release(object):
|
||||||
|
@staticmethod
|
||||||
|
def run(cmd, spl, length, authed, msg, agora, tx, ux, caller):
|
||||||
|
if length == 2:
|
||||||
|
tx = tx.ref_to_tx(spl[1])
|
||||||
|
if not tx:
|
||||||
|
msg(f"No such reference: {spl[1]}")
|
||||||
|
return
|
||||||
|
rtrn = caller.release_funds(tx)
|
||||||
|
message = rtrn["message"]
|
||||||
|
message_long = rtrn["response"]["data"]["message"]
|
||||||
|
msg(f"{message} - {message_long}")
|
||||||
|
|
||||||
|
class pubads(object):
|
||||||
|
@staticmethod
|
||||||
|
def run(cmd, spl, length, authed, msg, agora, tx, ux, asset_list, caller):
|
||||||
|
if length == 3:
|
||||||
|
asset = spl[1]
|
||||||
|
if asset not in loads(asset_list):
|
||||||
|
msg(f"Not a valid asset: {spl[1]}")
|
||||||
|
return
|
||||||
|
currency = spl[2]
|
||||||
|
rtrn = caller.get_all_public_ads(assets=[asset], currencies=[currency])
|
||||||
|
if not rtrn:
|
||||||
|
msg("No results.")
|
||||||
|
return
|
||||||
|
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(asset_list):
|
||||||
|
msg(f"Not a valid asset: {spl[1]}")
|
||||||
|
return
|
||||||
|
providers = spl[3].split(",")
|
||||||
|
currency = spl[2]
|
||||||
|
rtrn = caller.get_all_public_ads(assets=[asset], currencies=[currency], providers=providers)
|
||||||
|
if not rtrn:
|
||||||
|
msg("No results.")
|
||||||
|
return
|
||||||
|
for ad in rtrn[currency]:
|
||||||
|
msg(f"({ad[0]}) {ad[1]} {ad[2]} {ad[3]} {ad[4]} {ad[5]} {ad[6]}")
|
||||||
|
|
||||||
|
class cheat(object):
|
||||||
|
@staticmethod
|
||||||
|
def run(cmd, spl, length, authed, msg, agora, tx, ux, asset_list, caller):
|
||||||
|
if length == 1:
|
||||||
|
caller.run_cheat_in_thread()
|
||||||
|
msg("Running cheat in thread.")
|
||||||
|
elif length == 2:
|
||||||
|
asset = spl[1]
|
||||||
|
if asset not in loads(asset_list):
|
||||||
|
msg(f"Not a valid asset: {spl[1]}")
|
||||||
|
return
|
||||||
|
caller.run_cheat_in_thread([asset])
|
||||||
|
msg(f"Running cheat in thread for {asset}.")
|
||||||
|
|
||||||
|
class cheatnext(object):
|
||||||
|
@staticmethod
|
||||||
|
def run(cmd, spl, length, authed, msg, agora, tx, ux, caller):
|
||||||
|
if length == 1:
|
||||||
|
asset = caller.run_cheat_in_thread()
|
||||||
|
msg(f"Running next asset for cheat in thread: {asset}")
|
||||||
|
|
||||||
|
class ads(object):
|
||||||
|
@staticmethod
|
||||||
|
def run(cmd, spl, length, authed, msg, agora, tx, ux, caller):
|
||||||
|
ads = caller.enum_ads()
|
||||||
|
for ad in ads:
|
||||||
|
msg(f"({ad[0]}) {ad[1]} {ad[2]} {ad[3]} {ad[4]}")
|
||||||
|
|
||||||
|
class withdraw(object):
|
||||||
|
@staticmethod
|
||||||
|
def run(cmd, spl, length, authed, msg, agora, tx, ux, caller):
|
||||||
|
caller.withdraw_funds()
|
||||||
|
|
||||||
|
class nuke(object):
|
||||||
|
@staticmethod
|
||||||
|
def run(cmd, spl, length, authed, msg, agora, tx, ux, caller):
|
||||||
|
rtrn = caller.nuke_ads()
|
||||||
|
msg(dumps(rtrn))
|
||||||
|
|
||||||
|
|
||||||
|
class IRCCommands(object):
|
||||||
|
class atrades(object):
|
||||||
authed = True
|
authed = True
|
||||||
helptext = "Remove all duplicate adverts."
|
name = "atrades"
|
||||||
|
helptext = "Get all open trades for Agora."
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def run(cmd, spl, length, authed, msg, agora, tx, ux):
|
def run(cmd, spl, length, authed, msg, agora, tx, ux):
|
||||||
rtrn = agora.strip_duplicate_ads()
|
GenericCommands.trades.run(cmd, spl, length, authed, msg, agora, tx, ux, agora)
|
||||||
msg(dumps(rtrn))
|
|
||||||
|
class ltrades(object):
|
||||||
|
authed = True
|
||||||
|
name = "ltrades"
|
||||||
|
helptext = "Get all open trades for LBTC."
|
||||||
|
|
||||||
|
@staticmethod
|
||||||
|
def run(cmd, spl, length, authed, msg, agora, tx, ux):
|
||||||
|
GenericCommands.trades.run(cmd, spl, length, authed, msg, agora, tx, ux, tx.lbtc)
|
||||||
|
|
||||||
|
class acreate(object):
|
||||||
|
name = "acreate"
|
||||||
|
authed = True
|
||||||
|
helptext = "Create an ad on Agora. Usage: acreate <XMR/BTC> <country> <currency> [<provider>]"
|
||||||
|
|
||||||
|
@staticmethod
|
||||||
|
def run(cmd, spl, length, authed, msg, agora, tx, ux):
|
||||||
|
GenericCommands.create.run(
|
||||||
|
cmd,
|
||||||
|
spl,
|
||||||
|
length,
|
||||||
|
authed,
|
||||||
|
msg,
|
||||||
|
agora,
|
||||||
|
tx,
|
||||||
|
ux,
|
||||||
|
settings.Agora.AssetList,
|
||||||
|
settings.Agora.ProviderList,
|
||||||
|
agora,
|
||||||
|
)
|
||||||
|
|
||||||
|
class lcreate(object):
|
||||||
|
name = "lcreate"
|
||||||
|
authed = True
|
||||||
|
helptext = "Create an ad on LBTC. Usage: lcreate <XMR/BTC> <country> <currency> [<provider>]"
|
||||||
|
|
||||||
|
@staticmethod
|
||||||
|
def run(cmd, spl, length, authed, msg, agora, tx, ux):
|
||||||
|
GenericCommands.create.run(
|
||||||
|
cmd,
|
||||||
|
spl,
|
||||||
|
length,
|
||||||
|
authed,
|
||||||
|
msg,
|
||||||
|
agora,
|
||||||
|
tx,
|
||||||
|
ux,
|
||||||
|
settings.LocalBitcoins.AssetList,
|
||||||
|
settings.LocalBitcoins.ProviderList,
|
||||||
|
tx.lbtc,
|
||||||
|
)
|
||||||
|
|
||||||
|
class amessages(object):
|
||||||
|
authed = True
|
||||||
|
name = "amessages"
|
||||||
|
helptext = "Get messages for Agora. Usage: amessages [<reference>]"
|
||||||
|
|
||||||
|
@staticmethod
|
||||||
|
def run(cmd, spl, length, authed, msg, agora, tx, ux):
|
||||||
|
GenericCommands.messages.run(cmd, spl, length, authed, msg, agora, tx, ux, agora)
|
||||||
|
|
||||||
|
class lmessages(object):
|
||||||
|
authed = True
|
||||||
|
name = "lmessages"
|
||||||
|
helptext = "Get messages for LBTC. Usage: lmessages [<reference>]"
|
||||||
|
|
||||||
|
@staticmethod
|
||||||
|
def run(cmd, spl, length, authed, msg, agora, tx, ux):
|
||||||
|
GenericCommands.messages.run(cmd, spl, length, authed, msg, agora, tx, ux, tx.lbtc)
|
||||||
|
|
||||||
|
class adist(object):
|
||||||
|
authed = True
|
||||||
|
name = "adist"
|
||||||
|
helptext = "Distribute all our chosen currency and country ad pairs for Agora. Usage: adist [<XMR/BTC>]"
|
||||||
|
|
||||||
|
@staticmethod
|
||||||
|
def run(cmd, spl, length, authed, msg, agora, tx, ux):
|
||||||
|
GenericCommands.dist.run(cmd, spl, length, authed, msg, agora, tx, ux, settings.Agora.AssetList, agora)
|
||||||
|
|
||||||
|
class ldist(object):
|
||||||
|
authed = True
|
||||||
|
name = "ldist"
|
||||||
|
helptext = "Distribute all our chosen currency and country ad pairs for LBTC. Usage: ldist [<XMR/BTC>]"
|
||||||
|
|
||||||
|
@staticmethod
|
||||||
|
def run(cmd, spl, length, authed, msg, agora, tx, ux):
|
||||||
|
GenericCommands.dist.run(
|
||||||
|
cmd, spl, length, authed, msg, agora, tx, ux, settings.LocalBitcoins.AssetList, tx.lbtc
|
||||||
|
)
|
||||||
|
|
||||||
|
class aredist(object):
|
||||||
|
authed = True
|
||||||
|
name = "aredist"
|
||||||
|
helptext = "Update all ads with details for Agora."
|
||||||
|
|
||||||
|
@staticmethod
|
||||||
|
def run(cmd, spl, length, authed, msg, agora, tx, ux):
|
||||||
|
GenericCommands.redist.run(cmd, spl, length, authed, msg, agora, tx, ux, agora)
|
||||||
|
|
||||||
|
class lredist(object):
|
||||||
|
authed = True
|
||||||
|
name = "lredist"
|
||||||
|
helptext = "Update all ads with details for LBTC."
|
||||||
|
|
||||||
|
@staticmethod
|
||||||
|
def run(cmd, spl, length, authed, msg, agora, tx, ux):
|
||||||
|
GenericCommands.redist.run(cmd, spl, length, authed, msg, agora, tx, ux, tx.lbtc)
|
||||||
|
|
||||||
|
class astripdupes(object):
|
||||||
|
authed = True
|
||||||
|
name = "astripdupes"
|
||||||
|
helptext = "Remove all duplicate adverts for Agora."
|
||||||
|
|
||||||
|
@staticmethod
|
||||||
|
def run(cmd, spl, length, authed, msg, agora, tx, ux):
|
||||||
|
GenericCommands.stripdupes.run(cmd, spl, length, authed, msg, agora, tx, ux, agora)
|
||||||
|
|
||||||
|
class lstripdupes(object):
|
||||||
|
authed = True
|
||||||
|
name = "lstripdupes"
|
||||||
|
helptext = "Remove all duplicate adverts for LBTC."
|
||||||
|
|
||||||
|
@staticmethod
|
||||||
|
def run(cmd, spl, length, authed, msg, agora, tx, ux):
|
||||||
|
GenericCommands.stripdupes.run(cmd, spl, length, authed, msg, agora, tx, ux, tx.lbtc)
|
||||||
|
|
||||||
class total(object):
|
class total(object):
|
||||||
name = "total"
|
name = "total"
|
||||||
|
@ -212,21 +396,23 @@ class IRCCommands(object):
|
||||||
def run(cmd, spl, length, authed, msg, agora, tx, ux):
|
def run(cmd, spl, length, authed, msg, agora, tx, ux):
|
||||||
ux.notify.sendmsg("You have been summoned!")
|
ux.notify.sendmsg("You have been summoned!")
|
||||||
|
|
||||||
class message(object):
|
class amessage(object):
|
||||||
name = "msg"
|
|
||||||
authed = True
|
authed = True
|
||||||
helptext = "Send a message on a trade. Usage: msg <reference> <message...>"
|
name = "amsg"
|
||||||
|
helptext = "Send a message on a trade. Usage: amsg <reference> <message...>"
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def run(cmd, spl, length, authed, msg, agora, tx, ux):
|
def run(cmd, spl, length, authed, msg, agora, tx, ux):
|
||||||
if length > 2:
|
GenericCommands.message.run(cmd, spl, length, authed, msg, agora, tx, ux, agora.agora)
|
||||||
full_msg = " ".join(spl[2:])
|
|
||||||
reference = tx.ref_to_tx(spl[1])
|
class lmessage(object):
|
||||||
if not reference:
|
authed = True
|
||||||
msg(f"No such reference: {spl[1]}")
|
name = "lmsg"
|
||||||
return
|
helptext = "Send a message on a trade. Usage: lmsg <reference> <message...>"
|
||||||
rtrn = agora.agora.contact_message_post(reference, full_msg)
|
|
||||||
msg(f"Sent {full_msg} to {reference}: {rtrn}")
|
@staticmethod
|
||||||
|
def run(cmd, spl, length, authed, msg, agora, tx, ux):
|
||||||
|
GenericCommands.message.run(cmd, spl, length, authed, msg, agora, tx, ux, tx.lbtc.lbtc)
|
||||||
|
|
||||||
class refs(object):
|
class refs(object):
|
||||||
name = "refs"
|
name = "refs"
|
||||||
|
@ -266,22 +452,23 @@ class IRCCommands(object):
|
||||||
tx.del_ref(spl[1])
|
tx.del_ref(spl[1])
|
||||||
msg(f"Deleted reference: {spl[1]}")
|
msg(f"Deleted reference: {spl[1]}")
|
||||||
|
|
||||||
class release(object):
|
class arelease(object):
|
||||||
name = "release"
|
|
||||||
authed = True
|
authed = True
|
||||||
helptext = "Release funds for a trade. Usage: release <reference>"
|
name = "arelease"
|
||||||
|
helptext = "Release funds for a trade. Usage: arelease <reference>"
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def run(cmd, spl, length, authed, msg, agora, tx, ux):
|
def run(cmd, spl, length, authed, msg, agora, tx, ux):
|
||||||
if length == 2:
|
GenericCommands.release.run(cmd, spl, length, authed, msg, agora, tx, ux, agora)
|
||||||
tx = tx.ref_to_tx(spl[1])
|
|
||||||
if not tx:
|
class lrelease(object):
|
||||||
msg(f"No such reference: {spl[1]}")
|
authed = True
|
||||||
return
|
name = "lrelease"
|
||||||
rtrn = agora.release_funds(tx)
|
helptext = "Release funds for a trade. Usage: lrelease <reference>"
|
||||||
message = rtrn["message"]
|
|
||||||
message_long = rtrn["response"]["data"]["message"]
|
@staticmethod
|
||||||
msg(f"{message} - {message_long}")
|
def run(cmd, spl, length, authed, msg, agora, tx, ux):
|
||||||
|
GenericCommands.release.run(cmd, spl, length, authed, msg, agora, tx, ux, tx.lbtc)
|
||||||
|
|
||||||
class map(object):
|
class map(object):
|
||||||
name = "map"
|
name = "map"
|
||||||
|
@ -304,15 +491,23 @@ class IRCCommands(object):
|
||||||
msg(f"Could not release trade")
|
msg(f"Could not release trade")
|
||||||
return
|
return
|
||||||
|
|
||||||
class nuke(object):
|
class anuke(object):
|
||||||
name = "nuke"
|
|
||||||
authed = True
|
authed = True
|
||||||
helptext = "Delete all our adverts."
|
name = "anuke"
|
||||||
|
helptext = "Delete all our adverts for Agora."
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def run(cmd, spl, length, authed, msg, agora, tx, ux):
|
def run(cmd, spl, length, authed, msg, agora, tx, ux):
|
||||||
rtrn = agora.nuke_ads()
|
GenericCommands.nuke.run(cmd, spl, length, authed, msg, agora, tx, ux, agora)
|
||||||
msg(dumps(rtrn))
|
|
||||||
|
class lnuke(object):
|
||||||
|
authed = True
|
||||||
|
name = "lnuke"
|
||||||
|
helptext = "Delete all our adverts for Agora."
|
||||||
|
|
||||||
|
@staticmethod
|
||||||
|
def run(cmd, spl, length, authed, msg, agora, tx, ux):
|
||||||
|
GenericCommands.nuke.run(cmd, spl, length, authed, msg, agora, tx, ux, tx.lbtc)
|
||||||
|
|
||||||
class wallet(object):
|
class wallet(object):
|
||||||
name = "wallet"
|
name = "wallet"
|
||||||
|
@ -334,122 +529,81 @@ class IRCCommands(object):
|
||||||
msg(f"XMR wallet balance: {balance_xmr}")
|
msg(f"XMR wallet balance: {balance_xmr}")
|
||||||
msg(f"BTC wallet balance: {balance_btc}")
|
msg(f"BTC wallet balance: {balance_btc}")
|
||||||
|
|
||||||
class pubads(object):
|
class apubads(object):
|
||||||
name = "pubads"
|
|
||||||
authed = True
|
authed = True
|
||||||
helptext = "View public adverts for Agora. Usage: pubads <XMR/BTC> <currency> [<provider,...>]"
|
name = "apubads"
|
||||||
|
helptext = "View public adverts for Agora. Usage: apubads <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):
|
||||||
if length == 3:
|
GenericCommands.pubads.run(cmd, spl, length, authed, msg, agora, tx, ux, settings.Agora.AssetList, agora)
|
||||||
asset = spl[1]
|
|
||||||
if asset not in loads(settings.Agora.AssetList):
|
|
||||||
msg(f"Not a valid asset: {spl[1]}")
|
|
||||||
return
|
|
||||||
currency = spl[2]
|
|
||||||
rtrn = agora.get_all_public_ads(assets=[asset], currencies=[currency])
|
|
||||||
if not rtrn:
|
|
||||||
msg("No results.")
|
|
||||||
return
|
|
||||||
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):
|
|
||||||
msg(f"Not a valid asset: {spl[1]}")
|
|
||||||
return
|
|
||||||
providers = spl[3].split(",")
|
|
||||||
currency = spl[2]
|
|
||||||
rtrn = agora.get_all_public_ads(assets=[asset], currencies=[currency], providers=providers)
|
|
||||||
if not rtrn:
|
|
||||||
msg("No results.")
|
|
||||||
return
|
|
||||||
for ad in rtrn[currency]:
|
|
||||||
msg(f"({ad[0]}) {ad[1]} {ad[2]} {ad[3]} {ad[4]} {ad[5]} {ad[6]}")
|
|
||||||
|
|
||||||
class lpubads(object):
|
class lpubads(object):
|
||||||
|
authed = True
|
||||||
name = "lpubads"
|
name = "lpubads"
|
||||||
authed = True
|
helptext = "View public adverts for LBTC. Usage: lpubads <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):
|
||||||
if length == 3:
|
GenericCommands.pubads.run(
|
||||||
asset = spl[1]
|
cmd, spl, length, authed, msg, agora, tx, ux, settings.LocalBitcoins.AssetList, tx.lbtc
|
||||||
if asset not in loads(settings.LocalBitcoins.AssetList):
|
)
|
||||||
msg(f"Not a valid asset: {spl[1]}")
|
|
||||||
return
|
|
||||||
currency = spl[2]
|
|
||||||
rtrn = tx.lbtc.get_all_public_ads(assets=[asset], currencies=[currency])
|
|
||||||
if not rtrn:
|
|
||||||
msg("No results.")
|
|
||||||
return
|
|
||||||
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.LocalBitcoins.AssetList):
|
|
||||||
msg(f"Not a valid asset: {spl[1]}")
|
|
||||||
return
|
|
||||||
providers = spl[3].split(",")
|
|
||||||
currency = spl[2]
|
|
||||||
rtrn = tx.lbtc.get_all_public_ads(assets=[asset], currencies=[currency], providers=providers)
|
|
||||||
if not rtrn:
|
|
||||||
msg("No results.")
|
|
||||||
return
|
|
||||||
for ad in rtrn[currency]:
|
|
||||||
msg(f"({ad[0]}) {ad[1]} {ad[2]} {ad[3]} {ad[4]} {ad[5]} {ad[6]}")
|
|
||||||
|
|
||||||
class cheat(object):
|
class acheat(object):
|
||||||
name = "cheat"
|
|
||||||
authed = True
|
authed = True
|
||||||
helptext = "Cheat the markets by manipulating our prices to exploit people. Usage: cheat [<XMR/BTC>]"
|
name = "acheat"
|
||||||
|
helptext = "Cheat the markets by manipulating our prices to exploit people on Agora. Usage: acheat [<XMR/BTC>]"
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def run(cmd, spl, length, authed, msg, agora, tx, ux):
|
def run(cmd, spl, length, authed, msg, agora, tx, ux):
|
||||||
if length == 1:
|
GenericCommands.cheat.run(cmd, spl, length, authed, msg, agora, tx, ux, settings.Agora.AssetList, agora)
|
||||||
agora.run_cheat_in_thread()
|
|
||||||
msg("Running cheat in thread.")
|
|
||||||
elif length == 2:
|
|
||||||
asset = spl[1]
|
|
||||||
if asset not in loads(settings.Agora.AssetList):
|
|
||||||
msg(f"Not a valid asset: {spl[1]}")
|
|
||||||
return
|
|
||||||
agora.run_cheat_in_thread([asset])
|
|
||||||
msg(f"Running cheat in thread for {asset}.")
|
|
||||||
|
|
||||||
class cheatnext(object):
|
class lcheat(object):
|
||||||
name = "cheatnext"
|
|
||||||
authed = True
|
authed = True
|
||||||
helptext = "Run the next currency for cheat."
|
name = "lcheat"
|
||||||
|
helptext = "Cheat the markets by manipulating our prices to exploit people on LBTC. Usage: lcheat [<XMR/BTC>]"
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def run(cmd, spl, length, authed, msg, agora, tx, ux):
|
def run(cmd, spl, length, authed, msg, agora, tx, ux):
|
||||||
if length == 1:
|
GenericCommands.cheat.run(
|
||||||
asset = agora.run_cheat_in_thread()
|
cmd, spl, length, authed, msg, agora, tx, ux, settings.LocalBitcoins.AssetList, tx.lbtc
|
||||||
msg(f"Running next asset for cheat in thread: {asset}")
|
)
|
||||||
|
|
||||||
class ads(object):
|
class acheatnext(object):
|
||||||
name = "ads"
|
|
||||||
authed = True
|
authed = True
|
||||||
helptext = "Get all our ad regions for Agora"
|
name = "acheatnext"
|
||||||
|
helptext = "Run the next currency for cheat on Agora."
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def run(cmd, spl, length, authed, msg, agora, tx, ux):
|
def run(cmd, spl, length, authed, msg, agora, tx, ux):
|
||||||
ads = agora.enum_ads()
|
GenericCommands.cheatnext.run(cmd, spl, length, authed, msg, agora, tx, ux, agora)
|
||||||
for ad in ads:
|
|
||||||
msg(f"({ad[0]}) {ad[1]} {ad[2]} {ad[3]} {ad[4]}")
|
class lcheatnext(object):
|
||||||
|
authed = True
|
||||||
|
name = "lcheatnext"
|
||||||
|
helptext = "Run the next currency for cheat on LBTC."
|
||||||
|
|
||||||
|
@staticmethod
|
||||||
|
def run(cmd, spl, length, authed, msg, agora, tx, ux):
|
||||||
|
GenericCommands.cheatnext.run(cmd, spl, length, authed, msg, agora, tx, ux, tx.lbtc)
|
||||||
|
|
||||||
|
class aads(object):
|
||||||
|
authed = True
|
||||||
|
name = "aads"
|
||||||
|
helptext = "Get all our ad regions for Agora."
|
||||||
|
|
||||||
|
@staticmethod
|
||||||
|
def run(cmd, spl, length, authed, msg, agora, tx, ux):
|
||||||
|
GenericCommands.ads.run(cmd, spl, length, authed, msg, agora, tx, ux, agora)
|
||||||
|
|
||||||
class lads(object):
|
class lads(object):
|
||||||
name = "lads"
|
|
||||||
authed = True
|
authed = True
|
||||||
helptext = "Get all our ad regions for LocalBitcoins"
|
name = "lads"
|
||||||
|
helptext = "Get all our ad regions for LBTC."
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def run(cmd, spl, length, authed, msg, agora, tx, ux):
|
def run(cmd, spl, length, authed, msg, agora, tx, ux):
|
||||||
ads = tx.sources.lbtc.enum_ads()
|
GenericCommands.ads.run(cmd, spl, length, authed, msg, agora, tx, ux, tx.lbtc)
|
||||||
for ad in ads:
|
|
||||||
msg(f"({ad[0]}) {ad[1]} {ad[2]} {ad[3]} {ad[4]}")
|
|
||||||
|
|
||||||
class xmr(object):
|
class xmr(object):
|
||||||
name = "xmr"
|
name = "xmr"
|
||||||
|
@ -477,14 +631,23 @@ class IRCCommands(object):
|
||||||
price_gbp = xmr_prices["bitcoin"]["gbp"]
|
price_gbp = xmr_prices["bitcoin"]["gbp"]
|
||||||
msg(f"SEK: {price_sek} | USD: {price_usd} | GBP: {price_gbp}")
|
msg(f"SEK: {price_sek} | USD: {price_usd} | GBP: {price_gbp}")
|
||||||
|
|
||||||
class withdraw(object):
|
class awithdraw(object):
|
||||||
name = "withdraw"
|
|
||||||
authed = True
|
authed = True
|
||||||
helptext = "Take profit."
|
name = "awithdraw"
|
||||||
|
helptext = "Take profit for Agora."
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def run(cmd, spl, length, authed, msg, agora, tx, ux):
|
def run(cmd, spl, length, authed, msg, agora, tx, ux):
|
||||||
agora.withdraw_funds()
|
GenericCommands.withdraw.run(cmd, spl, length, authed, msg, agora, tx, ux, agora)
|
||||||
|
|
||||||
|
class lwithdraw(object):
|
||||||
|
authed = True
|
||||||
|
name = "lwithdraw"
|
||||||
|
helptext = "Take profit for LBTC."
|
||||||
|
|
||||||
|
@staticmethod
|
||||||
|
def run(cmd, spl, length, authed, msg, agora, tx, ux):
|
||||||
|
GenericCommands.withdraw.run(cmd, spl, length, authed, msg, agora, tx, ux, tx.lbtc)
|
||||||
|
|
||||||
class remaining(object):
|
class remaining(object):
|
||||||
name = "r"
|
name = "r"
|
||||||
|
|
Loading…
Reference in New Issue