1
0
mirror of https://github.com/eternnoir/pyTelegramBotAPI.git synced 2023-08-10 21:12:57 +03:00

Merge pull request #1599 from coder2020official/master

Fix group and supergroup issues with states
This commit is contained in:
Badiboy 2022-07-01 13:55:48 +03:00 committed by GitHub
commit d9ab5b0d28
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 5 additions and 5 deletions

View File

@ -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

View File

@ -149,10 +149,10 @@ 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'])
return FILE_URL.format(token, await get_file(token, file_id)['file_path'])
async def download_file(token, file_path):
@ -1821,4 +1821,4 @@ class RequestTimeout(Exception):
"""
This class represents a request timeout.
"""
pass
pass

View File

@ -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