diff --git a/bot/coins.py b/bot/coins.py index 1c3f66d..b0148ce 100644 --- a/bot/coins.py +++ b/bot/coins.py @@ -55,7 +55,12 @@ class Coins(Plugin): if currency not in self.CURRENCIES or crypto == currency: return '\x02[{}]\x02 Can\'t convert or invalid currency: {}'.format(crypto.upper(), currency) - data = requests.get(self.API_URL.format(crypto=crypto, market=market, currency=currency)) + def get_data(cur): + return requests.get(self.API_URL.format(crypto=crypto, market=market, currency=cur)) + + data = get_data(currency) + if not data and currency != 'usd': + data = get_data('usd') if not data: return '\x02[{}]\x02 No data received for currency {}'.format(crypto, currency)