Manages bot state transitions and corresponding behavior.
Submodules
Package Contents
Classes
-
class pipo.states.State(name: str)[source]
Bases: abc.ABC
State machine base.
Declares methods all concrete State should
implement and provides a reference to the associated Context object,
which can be used by States to transition Context to another State.
-
property context : Context
Associated context.
-
name : str
-
_context : Context
-
_logger : logging.Logger
-
abstract async join(ctx: discord.ext.commands.Context) → None[source]
Make bot connect to voice channel.
-
abstract async play(ctx: discord.ext.commands.Context, query: list[str], shuffle: bool) → None[source]
Add music to play.
- Parameters:
- ctx: discord.ext.commands.Context
Bot context.
- query: list[str]
Music to play.
- shuffle: bool
Randomize play order when multiple musics are provided.
-
abstract async skip() → None[source]
Skip currently playing music.
-
abstract async leave() → None[source]
Make bot leave the current server.
-
abstract async resume() → None[source]
Resume previously paused music.
-
abstract async clear() → None[source]
Reset music queue and halt currently playing audio.
-
abstract async pause() → None[source]
Pause currently playing music.
-
class pipo.states.Context(state)[source]
State machine context.
-
_state
-
_logger : logging.Logger
-
transition_to(state)[source]
Transition state to a new one.
- Parameters:
- state
Next state to transition.