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:
ZeroN 2023-10-20 17:25:05 +05:00 committed by GitHub
parent 98771fdf31
commit 9584ac9a5b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -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