mirror of
https://github.com/aiogram/aiogram.git
synced 2025-12-13 10:26:53 +00:00
Allow to use '*' and None as state in State object.
This commit is contained in:
parent
aa2468e19a
commit
4f0a3c607f
1 changed files with 9 additions and 1 deletions
|
|
@ -16,7 +16,11 @@ class State:
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def state(self):
|
def state(self):
|
||||||
if self._group_name is None and self._group:
|
if self._state is None:
|
||||||
|
return None
|
||||||
|
elif self._state == '*':
|
||||||
|
return self._state
|
||||||
|
elif self._group_name is None and self._group:
|
||||||
group = self._group.__full_group_name__
|
group = self._group.__full_group_name__
|
||||||
elif self._group_name:
|
elif self._group_name:
|
||||||
group = self._group_name
|
group = self._group_name
|
||||||
|
|
@ -157,3 +161,7 @@ class StatesGroup(metaclass=MetaStatesGroup):
|
||||||
|
|
||||||
await state.set_state(last_step_name)
|
await state.set_state(last_step_name)
|
||||||
return last_step_name
|
return last_step_name
|
||||||
|
|
||||||
|
|
||||||
|
default_state = State()
|
||||||
|
any_state = State(state='*')
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue