You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm using discord.js along with discord-player to play music. Other commands are working just fine, but when I use the play command and add music to the queue, the bot stops playing after 40-60 seconds and throws the error below.
I tried reviewing the libs' dependencies and even recreating the bot, but nothing seems to work. I ran out of ideas on how to fix this issue.
const{ useMainPlayer }=require("discord-player");const{
EmbedBuilder,
Application,
ApplicationCommandOptionType,}=require("discord.js");constdata={name: "play",description: "Play a song",options: [{name: "url",description: "Nome ou Link da música",type: ApplicationCommandOptionType.String,required: true,},],};asyncfunctionrun({ interaction, client }){constplayer=useMainPlayer(client);constchannel=interaction.member.voice.channel;if(!channel)returninteraction.reply("Você não está em um canal de voz!");constquery=interaction.options.getString("url",true);constembed=newEmbedBuilder().setAuthor({name: "Carregando música..."}).setColor("#8e44ad");constreply=awaitinteraction.reply({embeds: [embed]});try{const{ track }=awaitplayer.play(channel,query,{requestedBy: interaction.user,});if(track.playlist){embed.setAuthor({name: `Playlist adicionado á queue`,iconURL: client.user.displayAvatarURL(),}).setDescription(`▶️ Adicionado à queue: **${track.playlist.tracks.length} músicas** `).setTimestamp().toJSON();embed.setAuthor({name: `Música adicionada à queue!`,iconURL: client.user.displayAvatarURL(),}).setThumbnail(track.thumbnail).setDescription(`▶️ Adicionado à queue: **${track.title}** `).setFooter({text: `Comando executado por ${interaction.user.tag}`,iconURL: interaction.user.displayAvatarURL(),}).setTimestamp().toJSON();awaitreply.edit({embeds: [embed]});return;}}catch(error){embed.setAuthor({name: `Erro ao tocar a música!`,iconURL: client.user.displayAvatarURL(),}).setDescription(`❌ Ocorreu um erro ao tocar a música!`).setFooter({text: `Comando executado por ${interaction.user.tag}`,iconURL: interaction.user.displayAvatarURL(),}).setTimestamp().toJSON();awaitreply.edit({embeds: [embed]});return;}}module.exports={ data, run };
If it has to do with discord-player or similar packages or approaches that violate YouTube/other streaming services ToS, we won't help you with it.
In general, ECONNRESET means the TCP connection was terminated unexpectedly without fulfilling your request and is likely not related to the library. If you can reproduce the error in a minimal sample over extended periods of time, consider opening a separate issue.
Which package is this bug report for?
discord.js
Issue description
I'm using discord.js along with discord-player to play music. Other commands are working just fine, but when I use the play command and add music to the queue, the bot stops playing after 40-60 seconds and throws the error below.
I tried reviewing the libs' dependencies and even recreating the bot, but nothing seems to work. I ran out of ideas on how to fix this issue.
Error
Play Command
package.json
main.js
I read some articles about this and its seems unlikely that the error occurs on discord-player side
Versions
Issue priority
Medium (should be fixed soon)
Which gateway intents are you subscribing to?
Guilds, GuildVoiceStates
The text was updated successfully, but these errors were encountered: