mirror of
https://github.com/Redume/Shirino.git
synced 2025-02-04 09:58:57 +03:00
fix: did a check for negative numbers
This commit is contained in:
parent
a1ad2d1694
commit
0ca150eec8
1 changed files with 7 additions and 1 deletions
8
main.py
8
main.py
|
@ -39,7 +39,13 @@ async def currency(query: types.InlineQuery) -> None:
|
|||
from_currency, conv_currency = '', ''
|
||||
|
||||
if len(args) == 3:
|
||||
conv.amount = float(args[0].replace(',', '.'))
|
||||
try:
|
||||
conv.amount = float(args[0].replace(',', '.'))
|
||||
if conv.amount < 0:
|
||||
raise ValueError("Negative amounts are not supported.")
|
||||
except ValueError:
|
||||
return await reply(result_id, [("Please enter a positive amount.", None, None)], query)
|
||||
|
||||
from_currency = args[1]
|
||||
conv_currency = args[2]
|
||||
elif len(args) == 2:
|
||||
|
|
Loading…
Add table
Reference in a new issue