mirror of
https://github.com/aiogram/aiogram.git
synced 2026-04-08 16:37:47 +00:00
#1186 Renamed USER_IN_THREAD to USER_IN_TOPIC
This commit is contained in:
parent
d29b18da8c
commit
066d16b522
3 changed files with 6 additions and 6 deletions
|
|
@ -7,7 +7,7 @@ The strategy can be changed in dispatcher:
|
||||||
from aiogram.fsm.strategy import FSMStrategy
|
from aiogram.fsm.strategy import FSMStrategy
|
||||||
...
|
...
|
||||||
dispatcher = Dispatcher(
|
dispatcher = Dispatcher(
|
||||||
fsm_strategy=FSMStrategy.USER_IN_THREAD,
|
fsm_strategy=FSMStrategy.USER_IN_TOPIC,
|
||||||
storage=..., # Any persistent storage
|
storage=..., # Any persistent storage
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@ class FSMStrategy(Enum):
|
||||||
USER_IN_CHAT = auto()
|
USER_IN_CHAT = auto()
|
||||||
CHAT = auto()
|
CHAT = auto()
|
||||||
GLOBAL_USER = auto()
|
GLOBAL_USER = auto()
|
||||||
USER_IN_THREAD = auto()
|
USER_IN_TOPIC = auto()
|
||||||
|
|
||||||
|
|
||||||
def apply_strategy(
|
def apply_strategy(
|
||||||
|
|
@ -19,6 +19,6 @@ def apply_strategy(
|
||||||
return chat_id, chat_id, None
|
return chat_id, chat_id, None
|
||||||
if strategy == FSMStrategy.GLOBAL_USER:
|
if strategy == FSMStrategy.GLOBAL_USER:
|
||||||
return user_id, user_id, None
|
return user_id, user_id, None
|
||||||
if strategy == FSMStrategy.USER_IN_THREAD:
|
if strategy == FSMStrategy.USER_IN_TOPIC:
|
||||||
return chat_id, user_id, thread_id
|
return chat_id, user_id, thread_id
|
||||||
return chat_id, user_id, None
|
return chat_id, user_id, None
|
||||||
|
|
|
||||||
|
|
@ -24,9 +24,9 @@ class TestStrategy:
|
||||||
[FSMStrategy.GLOBAL_USER, CHAT, PRIVATE],
|
[FSMStrategy.GLOBAL_USER, CHAT, PRIVATE],
|
||||||
[FSMStrategy.GLOBAL_USER, PRIVATE, PRIVATE],
|
[FSMStrategy.GLOBAL_USER, PRIVATE, PRIVATE],
|
||||||
[FSMStrategy.GLOBAL_USER, THREAD, PRIVATE],
|
[FSMStrategy.GLOBAL_USER, THREAD, PRIVATE],
|
||||||
[FSMStrategy.USER_IN_THREAD, CHAT, CHAT],
|
[FSMStrategy.USER_IN_TOPIC, CHAT, CHAT],
|
||||||
[FSMStrategy.USER_IN_THREAD, PRIVATE, PRIVATE],
|
[FSMStrategy.USER_IN_TOPIC, PRIVATE, PRIVATE],
|
||||||
[FSMStrategy.USER_IN_THREAD, THREAD, THREAD],
|
[FSMStrategy.USER_IN_TOPIC, THREAD, THREAD],
|
||||||
],
|
],
|
||||||
)
|
)
|
||||||
def test_strategy(self, strategy, case, expected):
|
def test_strategy(self, strategy, case, expected):
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue