Fix ogre 2

This commit is contained in:
root 2018-07-28 20:14:37 +00:00
parent ab05ba5b60
commit 7e9c2f9117
1 changed files with 4 additions and 4 deletions

View File

@ -285,17 +285,17 @@ def trex(bot, trigger):
@sopel.module.commands('tradeogre', 'ogre') @sopel.module.commands('tradeogre', 'ogre')
def ogre(bot, trigger): def ogre(bot, trigger):
if not trigger.group(2): if not trigger.group(2):
pair = 'BTC-XMR' pair = 'BTC-XMR'
else: else:
coin = 'BTC-'+trigger.group(2).upper() pair = 'BTC-'+trigger.group(2).upper()
try: try:
r = requests.get(ogreurl) r = requests.get(ogreurl)
j = r.json() j = r.json()
for i in j: for i in j:
if pair == i.keys(): if pair == i.keys()[0]:
last=float(i[pair]['price']) last=float(i[pair]['price'])
vol=float(i[pair]['volume']) vol=float(i[pair]['volume'])
bot.say("Tradeogre at {0:.8f} BTC; on {1:.3f} BTC volume".format(last, vol)) bot.say("{0} on Tradeogre at {1:.8f} BTC on {2:.3f} BTC volume".format(pair, last, vol))
except: except:
bot.say("Error retrieving data from Ogre") bot.say("Error retrieving data from Ogre")