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:
ZeroN 2023-10-22 02:41:13 +05:00 committed by GitHub
parent 3b21262d34
commit d8e7801963
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 8 additions and 0 deletions

View file

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