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

Compare commits

..

6 Commits

Author SHA1 Message Date
Badiboy
5ca92ff637
Merge pull request #1465 from coder2020official/master
Added isinstance checkups in state filters
2022-02-26 13:07:53 +03:00
_run
f4c76553ed
Update asyncio_filters.py 2022-02-25 19:53:17 +05:00
_run
75baf6dd96
Update custom_filters.py 2022-02-25 19:52:56 +05:00
_run
301b9288a4
Merge branch 'eternnoir:master' into master 2022-02-25 19:47:50 +05:00
_run
70b9fc86d2
Update custom_filters.py 2022-02-25 19:46:49 +05:00
_run
dde9cd323c
Update asyncio_filters.py 2022-02-25 19:45:52 +05:00
2 changed files with 6 additions and 4 deletions

View File

@ -1,5 +1,6 @@
from abc import ABC from abc import ABC
from typing import Optional, Union from typing import Optional, Union
from telebot.asyncio_handler_backends import State
from telebot import types from telebot import types
@ -280,10 +281,10 @@ class StateFilter(AdvancedCustomFilter):
if isinstance(text, list): if isinstance(text, list):
new_text = [] new_text = []
for i in text: for i in text:
if isclass(i): i = i.name if isinstance(i, State): i = i.name
new_text.append(i) new_text.append(i)
text = new_text text = new_text
elif isinstance(text, object): elif isinstance(text, State):
text = text.name text = text.name
if message.chat.type == 'group': if message.chat.type == 'group':

View File

@ -1,5 +1,6 @@
from abc import ABC from abc import ABC
from typing import Optional, Union from typing import Optional, Union
from telebot.handler_backends import State
from telebot import types from telebot import types
@ -284,10 +285,10 @@ class StateFilter(AdvancedCustomFilter):
if isinstance(text, list): if isinstance(text, list):
new_text = [] new_text = []
for i in text: for i in text:
if isclass(i): i = i.name if isinstance(i, State): i = i.name
new_text.append(i) new_text.append(i)
text = new_text text = new_text
elif isinstance(text, object): elif isinstance(text, State):
text = text.name text = text.name
if message.chat.type == 'group': if message.chat.type == 'group':
group_state = self.bot.current_states.get_state(message.chat.id, message.from_user.id) group_state = self.bot.current_states.get_state(message.chat.id, message.from_user.id)