Search code examples
javascriptdiscord.jsdistube

DisTube not showing Song name and requested user


Distube is not showing the name of the song and the user who requested it. It shows the duration though. Any idea why?

Code:

client.distube
    .on("playSong", (song) => message.channel.send(
        `Playing \`${song.title}\` - \`${song.formattedDuration}\`\nRequested by: ${song.user}`
    ))

Output: output


Solution

  • Following the code here, the playSong event is emitted when a new song is played and has three parameters, namely

    message ( appends MessageObject from discord.js )
    queue ( your queue of songs )
    song ( this parameter contains your required values )

    So in your arrow function listener it'd be something like

    client.distube
        .on("playSong", (message, queue, song) => { message.channel.send(
            `Playing \`${song.title}\` - \`${song.formattedDuration}\`\nRequested by: ${song.user}`
        )
    });