Events: Deprecate ClientConnect (#112)

Discord no longer send these websocket payloads, users should instead rely on the main part of their bot for determining actual connection events, or `SpeakingUpdate`s for SSRC mapping.

Closes #104.
This commit is contained in:
Kyle Simpson
2022-02-13 12:06:50 +00:00
committed by GitHub
parent 2feadc761e
commit c464fcc38d
3 changed files with 30 additions and 23 deletions

View File

@@ -29,7 +29,7 @@ use serenity::{
use songbird::{
driver::DecodeMode,
model::payload::{ClientConnect, ClientDisconnect, Speaking},
model::payload::{ClientDisconnect, Speaking},
Config,
CoreEvent,
Event,
@@ -86,7 +86,7 @@ impl VoiceEventHandler for Receiver {
},
Ctx::SpeakingUpdate(data) => {
// You can implement logic here which reacts to a user starting
// or stopping speaking.
// or stopping speaking, and to map their SSRC to User ID.
println!(
"Source {} has {} speaking.",
data.ssrc,
@@ -114,19 +114,6 @@ impl VoiceEventHandler for Receiver {
// containing the call statistics and reporting information.
println!("RTCP packet received: {:?}", data.packet);
},
Ctx::ClientConnect(
ClientConnect {audio_ssrc, video_ssrc, user_id, ..}
) => {
// You can implement your own logic here to handle a user who has joined the
// voice channel e.g., allocate structures, map their SSRC to User ID.
println!(
"Client connected: user {:?} has audio SSRC {:?}, video SSRC {:?}",
user_id,
audio_ssrc,
video_ssrc,
);
},
Ctx::ClientDisconnect(
ClientDisconnect {user_id, ..}
) => {
@@ -224,11 +211,6 @@ async fn join(ctx: &Context, msg: &Message, mut args: Args) -> CommandResult {
Receiver::new(),
);
handler.add_global_event(
CoreEvent::ClientConnect.into(),
Receiver::new(),
);
handler.add_global_event(
CoreEvent::ClientDisconnect.into(),
Receiver::new(),