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

307
Views
discord.js bot reproduciendo audio pero sin sonido?

Estaba planeando agregar algunas funciones de voz a mi bot de Discord, pero por alguna razón, cuando ejecuto mi código, no emite ningún sonido , mientras que Discord muestra el círculo verde alrededor de mi bot, lo que indica que está emitiendo un sonido . Tampoco registra ningún error ni nada más, ¿alguien sabe qué le pasa a mi código?

Código:

 if (command == "soundtest") { mongo().then(async (mongoose) => { const { voice } = msg.member if (voice.channelID) { const vc = voice.channel // console.log(channel) try { vc.join().then(connection => { connection.play(path.join(__dirname, 'Bastille_Pompeii.mp3')) }) } catch(e) { console.log("error") console.log(e) } } else { msg.channel.send(`You must join a voice channel to use this command`) } }) }

¡Gracias por leer!

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

Este código debería funcionar para usted:

 const { createReadStream } = require('fs'); const { join } = require('path'); const { createAudioResource, StreamType, createAudioPlayer, joinVoiceChannel } = require('@discordjs/voice'); const player = createAudioPlayer() joinVoiceChannel({ channelId: message.member.voice.channel.id, guildId: message.guild.id, adapterCreator: message.guild.voiceAdapterCreator }).subscribe(player) let resource = createAudioResource(join('./folder/', '<song_name>.mp3')); player.play(resource)

Como dijiste, intentaste reproducir un archivo llamado Bastille_Pompeii.mp3 , por lo que debes definir el resource de esta manera: let resource = createAudioResource(join('./musicfiles/', 'Bastille_Pompeii.mp3'));

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