discord-player icon indicating copy to clipboard operation
discord-player copied to clipboard

The movie data is retrieved normally, but it is disconnected from the voice channel.

Open KohnoseLami opened this issue 2 years ago โ€ข 5 comments

Describe the bug

I'm running Node.js on a server that doesn't have root privileges So everything is done in Node.js inside Miniconda. I don't know if that's the reason, but I've been able to get track titles and call ffmpeg successfully, but the Bot will not play anything and will disconnect the voice channel.

To Reproduce Steps to reproduce the behavior:

Create a Bot with a simple connection and playback. And if I do that in my environment, the audio is cut off, not played.

Expected behavior

Play music

Screenshots

image

Please complete the following information:

  • Node Version: 16.13.1
  • Discord Player Version: 5,3,1
  • Discord.js Version: 14.3.0

Additional context

If you check the process with the ps x command, you can see that ffmpeg is running, but it's already disconnected from the voice channel. 36389 pts/0 Sl+ 0:00 ffmpeg -i - -ss 0 -analyzeduration 0 -loglevel 0 -f s16le -ar 48000 -ac 2 pipe:1

KohnoseLami avatar Aug 28 '22 07:08 KohnoseLami

There's a warning on the console, but I don't know what it means. And it doesn't show what's causing it, so if I have a problem, I'll ask for a hint.

KohnoseLami avatar Aug 28 '22 07:08 KohnoseLami

Could you provide your code snippet as well?

twlite avatar Aug 28 '22 08:08 twlite

There's a warning on the console, but I don't know what it means. And it doesn't show what's causing it, so if I have a problem, I'll ask for a hint.

The warning will disappear if you update it to Node.js 18 so I don't think that is related to the error.

retrouser955 avatar Aug 28 '22 08:08 retrouser955

Could you provide your code snippet as well?

Okay, code here.

const { Colors, ApplicationCommandOptionType } = require("discord.js")
const { settings } = require("../modules/static");
module.exports = {
    data: {
        name: "play",
        description: "ๆŒ‡ๅฎšใ—ใŸๆ›ฒใ‚’ๅ†็”Ÿใ—ใพใ™",
        dmPermission: false,
        options: [
            {
                name: "query",
                description: "ๆ›ฒใ‚’ๆŒ‡ๅฎšใ—ใฆใใ ใ•ใ„",
                type: ApplicationCommandOptionType.String,
                required: true
            }
        ]
    },
    async execute(i) {
        let queue = i.player.queues.get(i.guild.id);
        if (!queue) {
            if (!i.member.voice.channelId) {
                return i.reply({
                    embeds: [
                        {
                            title: "Join",
                            description: "ใƒœใ‚คใ‚นใƒใƒฃใƒณใƒใƒซใซๅ‚ๅŠ ใ™ใ‚‹ใซใฏใ€ใพใšใ‚ใชใŸใŒใƒœใ‚คใ‚นใƒใƒฃใƒณใƒใƒซใซๅฑ…ใ‚‹ๅฟ…่ฆใŒใ‚ใ‚Šใพใ™",
                            color: Colors.Red,
                            footer: settings.footer
                        }
                    ],
                    ephemeral: true
                })
            }
            queue = i.player.createQueue(i.guild, {
                metadata: {
                    channel: i.channel
                }
            })
            try {
                if (!queue.connection) await queue.connect(i.member.voice.channel);
            } catch {
                queue.destroy();
                return i.reply({
                    embeds: [
                        {
                            title: "Join",
                            description: "ใƒœใ‚คใ‚นใƒใƒฃใƒณใƒใƒซใซๆŽฅ็ถšใงใใพใ›ใ‚“ใงใ—ใŸ",
                            color: Colors.Red,
                            footer: settings.footer
                        }
                    ],
                    ephemeral: true
                })
            }
            await i.channel.send({
                embeds: [{
                    title: "Join",
                    description: `<#${i.member.voice.channelId}> ใซๅ‚ๅŠ ใ—ใพใ—ใŸ`,
                    color: Colors.Green,
                    footer: settings.footer
                }]
            })
        }
        await i.deferReply({ephemeral: false});
        if (!queue.connection) {
            i.followUp({
                embeds: [
                    {
                        title: "Join",
                        description: "BotใŒใƒœใ‚คใ‚นใƒใƒฃใƒณใƒใƒซใ‹ใ‚‰ๅˆ‡ๆ–ญใ•ใ‚Œใฆใ„ใพใ™",
                        color: Colors.Red,
                        footer: settings.footer
                    }
                ],
                ephemeral: true
            })
            return queue.destroy();
        }
        const query = i.options.getString("query");
        const track = await i.player.search(query, {
            requestedBy: i.user
        }).then(x => x.tracks[0]);
        if (!track) {
            return i.followUp({
                embeds: [
                    {
                        title: "Play",
                        description: "ๆ›ฒใŒ่ฆ‹ใคใ‹ใ‚Šใพใ›ใ‚“ใงใ—ใŸ",
                        color: Colors.Red,
                        footer: settings.footer
                    }
                ],
                ephemeral: true
            })
        }
        await queue.play(track);
        await i.followUp({
            embeds: [{
                title: "Play",
                description: `${track.title} ใ‚’ใ‚ญใƒฅใƒผใซ่ฟฝๅŠ ใ—ใพใ—ใŸ`,
                color: Colors.Green,
                footer: settings.footer
            }]
        })
    }
}

By the way, it worked when I ran it locally on Windows. I forgot to write.

KohnoseLami avatar Aug 28 '22 08:08 KohnoseLami

There's a warning on the console, but I don't know what it means. And it doesn't show what's causing it, so if I have a problem, I'll ask for a hint.

The warning will disappear if you update it to Node.js 18 so I don't think that is related to the error.

I see. Thank you.

KohnoseLami avatar Aug 28 '22 08:08 KohnoseLami

@KohnoseLami I have the same problem

ddemile avatar Jan 19 '23 10:01 ddemile

it's been a while now, but by chance were you guys using ubuntu 22 when this issue occurred?

twlite avatar Mar 04 '23 11:03 twlite

it's been a while now, but by chance were you guys using ubuntu 22 when this issue occurred?

No, Cent OS6 Running with Node.js in Miniconda

KohnoseLami avatar Mar 04 '23 11:03 KohnoseLami

it's been a while now, but by chance were you guys using ubuntu 22 when this issue occurred?

No, Cent OS6 Running with Node.js in Miniconda

if you are still using discord-player, could you try using the latest version (6.0.0) and see if it persists? If it does, could you run it in debug mode (attaching a debug event listener to player.events) and see if it shows anything?

twlite avatar Mar 04 '23 12:03 twlite

if you are still using discord-player, could you try using the latest version (6.0.0) and see if it persists? If it does, could you run it in debug mode (attaching a debug event listener to player.events) and see if it shows anything?

I'll try it.

KohnoseLami avatar Mar 04 '23 20:03 KohnoseLami

possible duplicate of https://github.com/Androz2091/discord-player/issues/1639 lets discuss there instead

twlite avatar Mar 21 '23 17:03 twlite