class Discord::VoiceClient
- Discord::VoiceClient
- Reference
- Object
Defined in:
discordcr/voice.crConstant Summary
-
ENCRYPTION_MODES =
{"xsalsa20_poly1305_lite", "xsalsa20_poly1305_suffix", "xsalsa20_poly1305"}
-
Supported encryption modes. Sorted by preference
-
Log =
Discord::Log.for("voice")
-
OP_HEARTBEAT =
3
-
OP_HELLO =
8
-
OP_IDENTIFY =
0
-
OP_READY =
2
-
OP_SELECT_PROTOCOL =
1
-
OP_SESSION_DESCRIPTION =
4
-
OP_SPEAKING =
5
-
UDP_PROTOCOL =
"udp"
Constructors
-
.new(payload : Discord::Gateway::VoiceServerUpdatePayload, session : Discord::Gateway::Session, user_id : UInt64 | Snowflake)
Creates a new voice client.
Instance Method Summary
-
#close
Closes the VWS connection, in effect disconnecting from voice.
-
#on_ready(&ready_handler : -> )
Sets the handler that should be run once the voice client has connected successfully.
-
#play_opus(buf : Bytes)
Plays a single opus packet
-
#run
Initiates the connection process and blocks forever afterwards.
-
#send_speaking(speaking : Bool, delay : Int32 = 0)
Sends a packet to indicate to Discord whether or not we are speaking right now
Constructor Detail
Creates a new voice client. The payload should be a payload received from Discord as part of a VOICE_SERVER_UPDATE dispatch, received after sending a voice state update (gateway op 4) packet. The session should be the session currently in use by the gateway client on which the aforementioned dispatch was received, and the user_id should be the user ID of the account on which the voice client is created. (It is received as part of the gateway READY dispatch, for example)
Instance Method Detail
Sets the handler that should be run once the voice client has connected successfully.
Sends a packet to indicate to Discord whether or not we are speaking right now