Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

144
Vistas
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 la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda