Фикс условием с написанием сообщения в группе

This commit is contained in:
Данил 2024-09-28 15:02:02 +03:00
parent c07fba01ad
commit c0e1698581

16
main.py
View file

@ -26,7 +26,12 @@ async def currency(query: types.Message | types.InlineQuery) -> None:
conv = Converter() conv = Converter()
if len(args) <= 1: if len(args) <= 1:
if query.chat.type not in ['supergroup', 'group']: try:
if query.chat.type in ['supergroup', 'group']:
return
except:
pass
return await reply(result_id, return await reply(result_id,
"2 or 3 arguments are required.", "2 or 3 arguments are required.",
"@shirino_bot USD RUB " "@shirino_bot USD RUB "
@ -44,7 +49,12 @@ async def currency(query: types.Message | types.InlineQuery) -> None:
from_currency_alias = args[0].lower() from_currency_alias = args[0].lower()
conv_currency_alias = args[1].lower() conv_currency_alias = args[1].lower()
else: else:
if query.chat.type not in ['supergroup', 'group']: 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) return await reply(result_id, 'The source and target currency could not be determined.', None, query)
from_currency, conv_currency = None, None 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, is_personal=True,
) )
else: else:
await query.answer(title) await query.answer(f'{title} \n{desc}')
async def main() -> None: async def main() -> None: