Loris Cuntreri
Loris Cuntreri

Reputation: 122

"Error [GUILD_VOICE_CHANNEL_RESOLVE]: Could not resolve channel to a guild voice channel." When using .setChannel()

I was updating my voice manager bot to discord.js v13 and ran into this error:

Error [GUILD_VOICE_CHANNEL_RESOLVE]: Could not resolve channel to a guild voice channel.

What my (full) code does is: An user joins a vocal channel, when he joins another vocal channel will be created and he'll be moved into that new channel, here's the function that triggers the error:

const createChannel = async (name, NewChannel, NewMember, parente, limit) => {
  NewMember.guild.channels
    .create(name, {
      type: "voice",
      parent: parente,
      userLimit: limit,
    })
    .then(async (channel) => {
      channel.setPosition(NewChannel.position + 1);
      await NewMember.setChannel(channel.id);
    });
};

Upvotes: 0

Views: 1610

Answers (1)

Loris Cuntreri
Loris Cuntreri

Reputation: 122

I did some research, after the update to discordjs v13, they changed the channel type when you run the .create() method, if you want to create a voice channel now you can't write like in v12, instead you'll need to write like this:

.create(name, {type: "GUILD_VOICE"})

If you need to create another type of channel, go to this link and check the "type" parameter from the properties list: DiscordJS guide website.

Upvotes: 2

Related Questions