Skip to content

~.result

Result

ResultReason

Bases: IntEnum

Reasons for a failed result state.

EMPTY_HISTORY class-attribute instance-attribute

EMPTY_HISTORY = 0

The audio history was empty.

EMPTY_QUEUE class-attribute instance-attribute

EMPTY_QUEUE = 1

The audio queue was empty.

NO_TRACK class-attribute instance-attribute

NO_TRACK = 2

No audio is currently playing.

NOT_FOUND class-attribute instance-attribute

NOT_FOUND = 3

The requested object could not be found.

PAUSED class-attribute instance-attribute

PAUSED = 4

The player is not currently playing.

PLAYING class-attribute instance-attribute

PLAYING = 5

The player is currently playing.

Result dataclass

Result(success: bool, reason: ResultReason | None)

The output of a method for UX.

Can be silently ignored or used for further functionality.

success instance-attribute

success: bool

If the method succeeded.

reason instance-attribute

reason: ResultReason | None

The reason for a failed state, if failed.

failed staticmethod

failed(reason: ResultReason) -> Result

Create a FAILED result.

succeeded staticmethod

succeeded() -> Result

Create a SUCCEEDED result.