From 3df80eb395050e8f797ecfb31b997d8f062457c7 Mon Sep 17 00:00:00 2001 From: scoobybejesus <21372487+scoobybejesus@users.noreply.github.com> Date: Fri, 29 Jan 2021 10:34:28 -0500 Subject: [PATCH] Make .top() go as high as monero; increase limit --- price.py | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/price.py b/price.py index 0b4e08a..cb9a83b 100644 --- a/price.py +++ b/price.py @@ -432,12 +432,21 @@ def top(bot, trigger): except: bot.say("Can't connect to coingecko API") 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: limit = int(trigger.group(2)) - if limit > 20: - bot.say("Too high! Max is 20!") - limit = 20 + if limit > 30: + bot.say("Too high! Max is 30!") + limit = 30 elif limit < 1: bot.say("Dude...") return