Update __init__.py
This commit is contained in:
parent
ce81833a48
commit
5b3d738d8d
1 changed files with 16 additions and 16 deletions
|
@ -13,22 +13,22 @@ api_key = 'd31697e581d5c35b038c625c'
|
|||
async def _(msg: Bot.MessageSession):
|
||||
base_currency = msg.parsed_msg['<base>'].upper()
|
||||
target_currency = msg.parsed_msg['<target>'].upper()
|
||||
"""
|
||||
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 or target_currency not in supported_currencies:
|
||||
unsupported_currencies = []
|
||||
if base_currency not in supported_currencies:
|
||||
unsupported_currencies.append(base_currency)
|
||||
if target_currency not in supported_currencies:
|
||||
unsupported_currencies.append(target_currency)
|
||||
await msg.finish(f"发生错误:无效的货币单位:{' '.join(unsupported_currencies)}")
|
||||
else:
|
||||
raise NoReportException(f"{response.text}")
|
||||
"""
|
||||
|
||||
# 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 or target_currency not in supported_currencies:
|
||||
# unsupported_currencies = []
|
||||
# if base_currency not in supported_currencies:
|
||||
# unsupported_currencies.append(base_currency)
|
||||
# if target_currency not in supported_currencies:
|
||||
# unsupported_currencies.append(target_currency)
|
||||
# await msg.finish(f"发生错误:无效的货币单位:{' '.join(unsupported_currencies)}")
|
||||
# else:
|
||||
# raise NoReportException(f"{response.text}")
|
||||
|
||||
amount = None
|
||||
while amount is None:
|
||||
try:
|
||||
|
|
Reference in a new issue