Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

134
Views
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
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!