_war_fsm
_war_fsm
¶
War state machine for tracking war transitions.
WarStateMachine
¶
WarStateMachine(initial_state: WarState = NOT_IN_WAR)
Tracks war state transitions for a single clan.
The CoC API returns war state as a string in clan_current_war().
This FSM detects when the state actually changes (vs. the same state
being reported on consecutive polls).
Source code in cocapi/events/_war_fsm.py
16 17 | |
transition
¶
transition(raw_state: str) -> WarState | None
Attempt a state transition.
| PARAMETER | DESCRIPTION |
|---|---|
raw_state
|
The
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
WarState | None
|
The new WarState if a transition occurred, or None if the state |
WarState | None
|
is unchanged or the raw_state is unrecognized. |
Source code in cocapi/events/_war_fsm.py
19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 | |