NetCord icon indicating copy to clipboard operation
NetCord copied to clipboard

Bot doesn't leave voice channel after calling CloseAsync() and Dispose()

Open LonelyWarriorxdd opened this issue 3 months ago • 3 comments

Description

After I finish music playback, I attempt to disconnect the bot from the voice channel using the following code:

await voiceClient.CloseAsync(); voiceClient.Dispose();

However, the bot does not leave the voice channel as expected.

Is this a bug or am i missing something?

Version

1.0.0-alpha.427

LonelyWarriorxdd avatar Sep 22 '25 18:09 LonelyWarriorxdd

The voice client connection isn't equivalent to the voice state. To make the bot not to display as if it was connected to the voice channel, you should call GatewayClient.UpdateVoiceStateAsync and specify a null channel ID in the VoiceStateProperties.

KubaZ2 avatar Sep 22 '25 18:09 KubaZ2

Thanks! All good now

LonelyWarriorxdd avatar Sep 22 '25 18:09 LonelyWarriorxdd

I will leave this issue open to make sure the guides will include this in the future.

KubaZ2 avatar Sep 22 '25 18:09 KubaZ2