Make .top() go as high as monero; increase limit

This commit is contained in:
scoobybejesus 2021-01-29 10:34:28 -05:00 committed by GitHub
parent 872e960dac
commit 3df80eb395
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 13 additions and 4 deletions

View File

@ -432,12 +432,21 @@ def top(bot, trigger):
except: except:
bot.say("Can't connect to coingecko API") bot.say("Can't connect to coingecko API")
if not trigger.group(2): if not trigger.group(2):
limit = 20 try:
r = requests.get('https://api.coingecko.com/api/v3/coins/'+'monero')
j = r.json()
mcaprank = j['market_cap_rank']
if mcaprank > 20:
limit = mcaprank
else:
limit = 20
except:
limit = 20
else: else:
limit = int(trigger.group(2)) limit = int(trigger.group(2))
if limit > 20: if limit > 30:
bot.say("Too high! Max is 20!") bot.say("Too high! Max is 30!")
limit = 20 limit = 30
elif limit < 1: elif limit < 1:
bot.say("Dude...") bot.say("Dude...")
return return