Bot thinks he is playing music but nothing is heard Discord.js Distube

256 views Asked by At

Basically a slash command is used to play a music video in Distube. Plays for around 30 seconds and completely stops even tho when I check the queue, it shows that he's still playing the music. I'm not getting any errors in my terminal or any logs related.

I'm not sure on what to give so please let me know

index.js

const distube = require("distube")
const Distube = new distube.DisTube(Client, {
    emitNewSongOnly: true,
    leaveOnStop:false,
    leaveOnFinish: false,
    updateYouTubeDL: true,
    nsfw: true,
    plugins:[new SpotifyPlugin()],
    youtubeCookie:"COOKIE"
})

play.js

module.exports = {
    data:{name:"play",description:"Play music",options:[{name:"query",description:"Get song name",type:"STRING",required:true}]},
    async execute(utils,Client,i,Discord,userModel,serverModel,banModel,Distube){
        if(!i.member.voice.channel)return i.reply({content:'Please join a voice channel',ephemeral:true})
        if(!i.guild.members.me.voice.channel == i.member.voice.channel)return i.reply({content:'We are not in the same voice channel',ephemeral:true})
        const song = i.options.getString("query")
        Distube.play(i.member.voice.channel, song, {member:i.member,textChannel:i.channel})
        i.reply({content:"Starting...",ephemeral:true})
    }
}

addSong.js

const {Distube} = require("../index")
const Discord = require("discord.js")
const utils = require("../utils/utils")
Distube.on("addSong", (queue,song) => {
    queue.textChannel.send({
        embeds:[
            new Discord.MessageEmbed()
            .setAuthor({name:`Added by ${song.user.username}`,iconURL:song.user.avatarURL()})
            .setTitle(song.name)
            .setThumbnail(song.thumbnail)
            .setURL(song.url)
            .addFields([
                {
                    name: '**Likes | Views**',
                    value: `**${utils.roundNumber(song.likes)} | ${utils.roundNumber(song.views)}**`,
                    inline: true
                },
                {
                    name:"**Duration | Position**",
                    value:`**${song.formattedDuration} | ${queue.songs.length}**`,
                    inline: true
                }
            ])
            .setFooter({text:`Volume: ${queue.volume}% | Loop: ${queue.repeatMode ? queue.repeatMode == 2 ? "All Queue" : "This Song" : "Off"}`})
        ]
    })
})

Discord.js 13.15.0 Distube 3.3.4 Node 18.14.2

UPDATE

To fix this issue Update to the latest version of distube

1

There are 1 answers

0
André Reis On

This seems a node_module version issue, probably with distube/voice? This isn't needed to be specified. Please take a look on my packages versions that's perfectly working.

"dependencies": {
    "@discordjs/opus": "^0.8.0",
    "@distube/soundcloud": "^1.2.1",
    "@distube/spotify": "^1.5.1",
    "@distube/yt-dlp": "^1.1.3",
    "discord.js": "^14.0.3",
    "distube": "^4.0.4",
    "dotenv": "10.0.0",
    "ffmpeg-static": "^4.4.1",
    "libsodium-wrappers": "^0.7.10"
  }