From d14064a84d6cd7a00c062d8364f10131109fe032 Mon Sep 17 00:00:00 2001 From: _run Date: Thu, 30 Jun 2022 17:51:58 +0500 Subject: [PATCH 1/3] Fix group and supergroup issues --- telebot/asyncio_filters.py | 2 +- telebot/custom_filters.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/telebot/asyncio_filters.py b/telebot/asyncio_filters.py index c594d31..8819be5 100644 --- a/telebot/asyncio_filters.py +++ b/telebot/asyncio_filters.py @@ -307,7 +307,7 @@ class StateFilter(AdvancedCustomFilter): elif isinstance(text, State): text = text.name - if message.chat.type == 'group': + if message.chat.type in ['group', 'supergroup']: group_state = await self.bot.current_states.get_state(user_id, chat_id) if group_state == text: return True diff --git a/telebot/custom_filters.py b/telebot/custom_filters.py index abeffdd..02edd07 100644 --- a/telebot/custom_filters.py +++ b/telebot/custom_filters.py @@ -315,7 +315,7 @@ class StateFilter(AdvancedCustomFilter): elif isinstance(text, State): text = text.name - if message.chat.type == 'group': + if message.chat.type in ['group', 'supergroup']: group_state = self.bot.current_states.get_state(user_id, chat_id) if group_state == text: return True From 5939e754bbd1619566f66eeb0b50887e9590ccc5 Mon Sep 17 00:00:00 2001 From: _run Date: Fri, 1 Jul 2022 15:29:34 +0500 Subject: [PATCH 2/3] Update asyncio_helper.py --- telebot/asyncio_helper.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/telebot/asyncio_helper.py b/telebot/asyncio_helper.py index 168edff..17575e7 100644 --- a/telebot/asyncio_helper.py +++ b/telebot/asyncio_helper.py @@ -149,7 +149,7 @@ async def get_file(token, file_id): async def get_file_url(token, file_id): if FILE_URL is None: - return "https://api.telegram.org/file/bot{0}/{1}".format(token, get_file(token, file_id)['file_path']) + return "https://api.telegram.org/file/bot{0}/{1}".format(token, await get_file(token, file_id)['file_path']) else: # noinspection PyUnresolvedReferences return FILE_URL.format(token, get_file(token, file_id)['file_path']) @@ -1821,4 +1821,4 @@ class RequestTimeout(Exception): """ This class represents a request timeout. """ - pass \ No newline at end of file + pass From c920809fa9d3e800343f13eb74e2e44c5a9e9859 Mon Sep 17 00:00:00 2001 From: _run Date: Fri, 1 Jul 2022 15:39:42 +0500 Subject: [PATCH 3/3] Update asyncio_helper.py --- telebot/asyncio_helper.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/telebot/asyncio_helper.py b/telebot/asyncio_helper.py index 17575e7..75492af 100644 --- a/telebot/asyncio_helper.py +++ b/telebot/asyncio_helper.py @@ -152,7 +152,7 @@ async def get_file_url(token, file_id): return "https://api.telegram.org/file/bot{0}/{1}".format(token, await get_file(token, file_id)['file_path']) else: # noinspection PyUnresolvedReferences - return FILE_URL.format(token, get_file(token, file_id)['file_path']) + return FILE_URL.format(token, await get_file(token, file_id)['file_path']) async def download_file(token, file_path):