~.gateway
Gateway
GatewayPayload
Base payload implementation.
GatewayReadyPayload
dataclass
Bases: GatewayPayload
Voice gateway READY operation payload.
modes
instance-attribute
All acceptable encryption modes that Discord's voice server supports.
GatewayReport
dataclass
GatewayReport(
signal: (
DisconnectSignal | ReconnectSignal | ResumeSignal
),
)
A connection report from the voice gateway.
signal
instance-attribute
signal: DisconnectSignal | ReconnectSignal | ResumeSignal
The signal raised by the voice gateway.
GatewaySessionDescriptionPayload
dataclass
Bases: GatewayPayload
Voice gateway SESSION_DESCRIPTION payload.
dave_protocol_version
instance-attribute
dave_protocol_version: int
The initial DAVE protocol version the Discord voice server will use.
GatewayState
Bases: IntEnum
Current state of a voice gateway.
CONNECTED
class-attribute
instance-attribute
CONNECTED = 0
Voice gateway is connected.
CONNECTING
class-attribute
instance-attribute
CONNECTING = 1
Voice gateway is connecting.
DISCONNECTED
class-attribute
instance-attribute
DISCONNECTED = 2
Voice gateway is not connected.
DISCONNECTING
class-attribute
instance-attribute
DISCONNECTING = 3
Voice gateway is disconnecting.
VoiceGateway
VoiceGateway(connection: VoiceConnection)
Discord voice gateway connection manager.
Create a Discord voice gateway connection manager.
| PARAMETER | DESCRIPTION |
|---|---|
connection
|
The active voice connection.
TYPE:
|
connect
async
connect(url: str) -> None
Connect to a Discord voice gateway endpoint.
| PARAMETER | DESCRIPTION |
|---|---|
url
|
The websocket URL to Discord's voice gateway.
TYPE:
|
disconnect
async
disconnect() -> None
Disconnect from Discord's voice gateway.
select_protocol
async
set_callback
set_callback(
opcode: Opcode,
callback: Callable[
[GatewayPayload], Coroutine[Any, Any, None]
],
) -> None
Set a callback method for the arrival of a specific voice gateway operation code.
| PARAMETER | DESCRIPTION |
|---|---|
opcode
|
The voice gateway operation code to listen for.
TYPE:
|
callback
|
The asynchronous method to call as the callback with the payload of this operation.
TYPE:
|