mirror of
https://github.com/Redume/Shirino.git
synced 2024-12-03 13:36:21 +03:00
добавления нового условия еще че та
This commit is contained in:
parent
8c3f7d36d8
commit
f13ff07de7
1 changed files with 16 additions and 2 deletions
18
main.py
18
main.py
|
@ -183,6 +183,22 @@ async def currency(inline_query: types.InlineQuery) -> None:
|
|||
conv = CurrencyConverter()
|
||||
|
||||
try:
|
||||
log.debug(len(args))
|
||||
if len(args) <= 1:
|
||||
article[0] = types.InlineQueryResultArticle(
|
||||
id=result_id,
|
||||
title="Требуется 2, либо 3 аргумента",
|
||||
description=f"@shirino_bot USD RUB \n@shirino_bot 12 USD RUB",
|
||||
input_message_content=types.InputTextMessageContent(
|
||||
message_text="Требуется 2, либо 3 аргумента"
|
||||
)
|
||||
)
|
||||
|
||||
await inline_query.answer(
|
||||
article,
|
||||
cache_time=1,
|
||||
is_personal=True,
|
||||
)
|
||||
if len(args) == 3:
|
||||
conv.amount = float(args[0])
|
||||
conv.from_currency = args[1].upper()
|
||||
|
@ -192,8 +208,6 @@ async def currency(inline_query: types.InlineQuery) -> None:
|
|||
conv.from_currency = args[0].upper()
|
||||
conv.conv_currency = args[1].upper()
|
||||
conv.convert()
|
||||
else:
|
||||
raise ValueError('Надо 2 или 3 аргумента')
|
||||
|
||||
result = (
|
||||
f'{conv.amount} {conv.from_currency} = '
|
||||
|
|
Loading…
Add table
Reference in a new issue