Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

260
Visualizações
Join an specific voice channel when the bot is ready in discord.js v13

I found some articles about this question. like this.

But it was in discord v12. I want discord.js v13

My code:

client.on("ready", async() => {
const { joinVoiceChannel } = require('@discordjs/voice');
joinVoiceChannel({
            channelId: "863783336860975114",
            guildId: "847071265100791849",
            adapterCreator: channelId.guild.voiceAdapterCreator
        })

// It does not work
}

How can I make my bot that it joins a specific channel when it's ready?

I am using discord.js v13 and node.js v16.15

about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

In the documentation for @discordjs/voice an in the discord.js guide we see:

const { joinVoiceChannel } = require('@discordjs/voice');

const connection = joinVoiceChannel({
    channelId: channel.id,
    guildId: channel.guild.id,
    adapterCreator: channel.guild.voiceAdapterCreator,
});

You need to fetch the guild or channel first since you need to use a voiceAdapterCreator.

You can use something like client.channels.fetch to get the channel object.

Example code to put inside ready event:

client.channels.fetch(id) // voice channel's id
    .then((channel) => { // channel object

        const VoiceConnection = joinVoiceChannel({
            channelId: channel.id, // the voice channel's id
            guildId: channel.guild.id, // the guild that the channel is in
            adapterCreator: channel.guild.voiceAdapterCreator // and setting the voice adapter creator
        });
    });

about 4 years ago · Juan Pablo Isaza Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda