update currency api

This commit is contained in:
iou1name 2021-04-22 12:54:05 -04:00
parent a632948414
commit 20d52f40c4

View File

@ -8,7 +8,7 @@ import requests
import config import config
from module import commands, example from module import commands, example
CUR_URI = "https://v3.exchangerate-api.com/bulk/{API_KEY}/{CUR_FROM}" CUR_URI = "https://v6.exchangerate-api.com/v6/{API_KEY}/latest/{CUR_FROM}"
BTC_URI = "https://api.coindesk.com/v1/bpi/currentprice/{CUR_TO}.json" BTC_URI = "https://api.coindesk.com/v1/bpi/currentprice/{CUR_TO}.json"
@commands('cur', 'currency', 'exchange') @commands('cur', 'currency', 'exchange')
@ -40,7 +40,7 @@ def exchange(bot, trigger):
if data["result"] == "error": if data["result"] == "error":
return bot.msg("Error: " + data["error"]) return bot.msg("Error: " + data["error"])
rate = data["rates"].get(cur_to) rate = data["conversion_rates"].get(cur_to)
if not rate: if not rate:
return bot.msg("Invalid output currency. Must be ISO 4217 compliant.") return bot.msg("Invalid output currency. Must be ISO 4217 compliant.")