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

135
Visualizações
My bot glows green for a second, then stops

Right now, I only really want my bot to play one file directly off my computer. Here's the code:

const { Client, Intents, MessageEmbed } = require('discord.js');
const { token } = require('./config.json');
const { joinVoiceChannel, createAudioPlayer, createAudioResource} = require('@discordjs/voice');
const { join } = require('path')
const client = new Client({ intents: [Intents.FLAGS.GUILDS, Intents.FLAGS.GUILD_MEMBERS, Intents.FLAGS.GUILD_MESSAGES, Intents.FLAGS.GUILD_VOICE_STATES] });

client.once('ready', () => {
    console.log('Ready!');
});

client.on('messageCreate', msg => {
    if(msg.content === '!join') {
    connection = joinVoiceChannel({
        channelId: msg.member.voice.channel.id,
        guildId: msg.guild.id,
        adapterCreator: msg.guild.voiceAdapterCreator
    })
    }

    if (msg.content === '!play') {
    console.log(generateDependencyReport())
    const player = createAudioPlayer()
    let resource = createAudioResource(join('./Downloads/', 'musicFile.mp3'));
    player.play(resource)
    connection.subscribe(player)
    }
}
client.login(token);

I'm not really facing trouble getting my bot to join, but once I tell it to play the file, it doesn't play anything. Rather it flashes green for a second then just stays silent. I've made sure that all my intents are on, and I've also checked that all my dependencies are up to date. Thank you for reading! Btw discord.js v13 is the version I'm running

about 4 years ago · Juan Pablo Isaza
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