mirror of
https://github.com/aiogram/aiogram.git
synced 2026-04-08 16:37:47 +00:00
Add new strategy CHAT_TOPIC strategy.py
The new FSM strategy, which sets the state for the entire topic in the chat, also works in private messages and regular groups without topics.
This commit is contained in:
parent
98771fdf31
commit
9584ac9a5b
1 changed files with 3 additions and 1 deletions
|
|
@ -7,7 +7,7 @@ class FSMStrategy(Enum):
|
|||
CHAT = auto()
|
||||
GLOBAL_USER = auto()
|
||||
USER_IN_TOPIC = auto()
|
||||
|
||||
CHAT_TOPIC = auto()
|
||||
|
||||
def apply_strategy(
|
||||
strategy: FSMStrategy,
|
||||
|
|
@ -21,4 +21,6 @@ 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, None, thread_id
|
||||
return chat_id, user_id, None
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue