mirror of
https://github.com/aiogram/aiogram.git
synced 2026-04-08 16:37:47 +00:00
Add new FSM strategy CHAT_TOPIC strategy.py (#1344)
* Create 1343.feature.rst * Add new FSM strategy CHAT_TOPIC strategy.py * ADD CHAT_TOPIC tests test_strategy.py * Update 1343.feature.rst * Update strategy.py * add typing user_id: Optional[int] = None, middleware.py * add typing user_id: Optional[int] = None base.py * Update strategy.py * Update strategy.py * Update middleware.py * Update base.py * Update test_strategy.py * Update base.py * Update strategy.py
This commit is contained in:
parent
3b21262d34
commit
d8e7801963
3 changed files with 8 additions and 0 deletions
|
|
@ -7,6 +7,7 @@ class FSMStrategy(Enum):
|
|||
CHAT = auto()
|
||||
GLOBAL_USER = auto()
|
||||
USER_IN_TOPIC = auto()
|
||||
CHAT_TOPIC = auto()
|
||||
|
||||
|
||||
def apply_strategy(
|
||||
|
|
@ -21,4 +22,7 @@ def apply_strategy(
|
|||
return user_id, user_id, None
|
||||
if strategy == FSMStrategy.USER_IN_TOPIC:
|
||||
return chat_id, user_id, thread_id
|
||||
if strategy == FSMStrategy.CHAT_TOPIC:
|
||||
return chat_id, chat_id, thread_id
|
||||
|
||||
return chat_id, user_id, None
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue