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

19 lines
540 B
Python
Raw Normal View History

2022-02-19 21:37:03 +03:00
from telebot.asyncio_middlewares import BaseMiddleware
2022-01-24 20:24:56 +03:00
class State:
def __init__(self) -> None:
self.name = None
2022-02-19 21:37:03 +03:00
2022-01-24 20:24:56 +03:00
def __str__(self) -> str:
return self.name
2022-02-19 21:37:03 +03:00
2022-01-24 20:24:56 +03:00
class StatesGroup:
def __init_subclass__(cls) -> None:
# print all variables of a subclass
for name, value in cls.__dict__.items():
if not name.startswith('__') and not callable(value) and isinstance(value, State):
# change value of that variable
value.name = ':'.join((cls.__name__, name))