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

537
Visualizações
How would I detect when a user is speaking in a voice channel discord.JS v13

I’ve been searching online for this for hours, and haven’t been able to find anything that is new.

I do know that the audio stuff is in a different package now though.

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

0

I know I'm a little late and that there's already an answer but here is some code using the libraries discord.js and @discordjs/voice

npm i discord.js
npm i @discordjs/voice
//requirements
const discord = require('discord.js')
const voice = require('@discordjs/voice')
const client = new discord.Client({intents: Object.values(discord.Intents.FLAGS)}) //Object.values(discord.Intents.FLAGS) is used to get every intents 
//on ready
client.on('ready', () => {
    //log username
    console.log(client.user.username)
})
//
var connection
//when a message is sent
client.on('messageCreate', (message) => {
    //split message by args
    const args = message.content.split(' ')
    if(args[0] == "join") {
        //check if the message author is in a voice channel
        if(message.guild.members.cache.get(message.author.id) == null) return 
        //create a new voice connection (join a voice channel)
        connection = voice.joinVoiceChannel({
            channelId: message.guild.members.cache.get(message.author.id).voice.channel.id, //the id of the channel to join (we're using the author voice channel)
            guildId: message.guild.id, //guild id (using the guild where the message has been sent)
            adapterCreator: message.guild.voiceAdapterCreator //voice adapter creator
        })
        connection.receiver.speaking.on('start', (userId) => {
            //actions here
            console.log(userId)
        })
    }
    if(args[0] == "destroy") {
        if(connection == undefined) return message.channel.send('the bot isn\'t in a voice channel')
        //leave
        connection.destroy()
        connection = undefined
    }
})
client.login("token here") 
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