How to make the bot leave a voice chat?

I have tried several options:
 let connection = getVoiceConnection(interaction.guild.id);
        if (connection === undefined) {
            await interaction.reply("I am not in a vc!");
            return;
        };
        connection.destroy();

interaction.guild.members.me.voice.channel.leave()

interaction.guild.member.voice.channel.leave()

none working.
Was this page helpful?