Update custom_filters.py

This commit is contained in:
_run 2022-02-25 19:46:49 +05:00 committed by GitHub
parent dde9cd323c
commit 70b9fc86d2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 2 deletions

View File

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