Archived
1
0
Fork 0
This commit is contained in:
多羅狼 2023-04-18 12:52:38 +08:00 committed by GitHub
parent a2fee8bb02
commit a9de4a1bd5
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -16,6 +16,7 @@ async def _(msg: Bot.MessageSession):
url = f'https://v6.exchangerate-api.com/v6/{api_key}/codes'
response = requests.get(url)
if response.status_code == 200:
data = response.json()
supported_currencies = data['supported_codes']
if base_currency not in supported_currencies:
await msg.finish("发生错误:无效的货币单位:" + base_currency)