From c0e1698581ebc42eeb112736ae0d9979fb7d040c Mon Sep 17 00:00:00 2001 From: Redume Date: Sat, 28 Sep 2024 15:02:02 +0300 Subject: [PATCH] =?UTF-8?q?=D0=A4=D0=B8=D0=BA=D1=81=20=D1=83=D1=81=D0=BB?= =?UTF-8?q?=D0=BE=D0=B2=D0=B8=D0=B5=D0=BC=20=D1=81=20=D0=BD=D0=B0=D0=BF?= =?UTF-8?q?=D0=B8=D1=81=D0=B0=D0=BD=D0=B8=D0=B5=D0=BC=20=D1=81=D0=BE=D0=BE?= =?UTF-8?q?=D0=B1=D1=89=D0=B5=D0=BD=D0=B8=D1=8F=20=D0=B2=20=D0=B3=D1=80?= =?UTF-8?q?=D1=83=D0=BF=D0=BF=D0=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- main.py | 28 +++++++++++++++++++--------- 1 file changed, 19 insertions(+), 9 deletions(-) diff --git a/main.py b/main.py index 2ee56f0..75f264a 100644 --- a/main.py +++ b/main.py @@ -26,12 +26,17 @@ async def currency(query: types.Message | types.InlineQuery) -> None: conv = Converter() if len(args) <= 1: - if query.chat.type not in ['supergroup', 'group']: - return await reply(result_id, - "2 or 3 arguments are required.", - "@shirino_bot USD RUB " - "\n@shirino_bot 12 USD RUB", - query) + try: + if query.chat.type in ['supergroup', 'group']: + return + except: + pass + + return await reply(result_id, + "2 or 3 arguments are required.", + "@shirino_bot USD RUB " + "\n@shirino_bot 12 USD RUB", + query) if len(args) == 4: conv.amount = float(args[0]) from_currency_alias = args[1].lower() @@ -44,8 +49,13 @@ async def currency(query: types.Message | types.InlineQuery) -> None: from_currency_alias = args[0].lower() conv_currency_alias = args[1].lower() else: - if query.chat.type not in ['supergroup', 'group']: - return await reply(result_id, 'The source and target currency could not be determined.', None, query) + try: + if query.chat.type in ['supergroup', 'group']: + return + except: + pass + + return await reply(result_id, 'The source and target currency could not be determined.', None, query) from_currency, conv_currency = None, None @@ -93,7 +103,7 @@ async def reply(result_id: str | None, title: str | None, desc, query: types.Inl is_personal=True, ) else: - await query.answer(title) + await query.answer(f'{title} \n{desc}') async def main() -> None: