discordjs / voice

Implementation of the Discord Voice API for discord.js and other JS/TS libraries
Apache License 2.0
327 stars 111 forks source link

Shard reconnect when trying to join voice channel using discordjs/voice #179

Closed phamleduy04 closed 3 years ago

phamleduy04 commented 3 years ago

Please describe the problem you are having in as much detail as possible: When I'm trying to join a voice channel using joinVoiceChannel(), the shard restart itself and the bot won't join a channel. Include a reproducible code sample here, if possible:

// Place your code here
const { joinVoiceChannel } = require('@discordjs/voice');
module.exports = {
    name: 'test',
    run: async (client, message, args) => {
        const voiceChannel = message.member.voice.channel;
        if (!voiceChannel) return message.reply('Join channel pls.');
        await joinVoiceChannel({
            channelId: voiceChannel.id,
            guildID: message.guild.id,
            selfDeaf: true,
            adapterCreator: message.guild.voiceAdapterCreator,
        });
    },
};

Further details:

Relevant client options:

Muh9049 commented 3 years ago

@phamleduy04 You need to change this part to guildId: message.guild.id and then it will join the voice channel.

As for the shard restarting itself, I'm unable to reproduce it. But by changing guildID to guildId, it should join. image

phamleduy04 commented 3 years ago

oh yes my bad, when I changed to guildId it join and I no longer have issue with shard anymore, thanks.