#archive-voice

30636 messages · Page 8 of 31

dusky hatch

thanks

misty saddle

🙂

neat comet

Would you need FFMPEG to use this module?

scarlet thistle

Yes

neat comet

Okay, thank you.
As in the guide, it says FFMPEG allows you to play multiple formats.

scarlet thistle

Need more clearly guide for discordjs/voice in v13 tbh

autumn pebble

how do i get the subscribed audioplayer through the getConnection metjhod

neon ibex
audioPlayer.on('stateChange', (oldState, newState) => {
    if (newState.status === AudioPlayerStatus.Idle && oldState.status !== AudioPlayerStatus.Idle) {
        processQueue();
    }
})

audioPlayer.on(AudioPlayerStatus.Idle, (oldState, newState) => {
    processQueue();
})

Which one is better to check the song finished?

autumn pebble

obio the second one, its shorter, no need to ask this

neon ibex

I asked the question because the example was like the code above. Are they in the same way?

autumn pebble

yes

neon ibex

Thanks

neon ibex
rustic belfry

how to make the bot joins a voice channel?

sly bear

thank you

neon ibex

I checked the phenomenon of moving to idle before the song was finished.

umbral gyro

With the new voice package, do i still need the opus package?

umbral gyro

ok

rain flare

I want to see docs for voice, where to find

fervent estuary

see pins

rain flare
rare cosmos
/home/container/src/commands/Music/skip.js:33
        queue.connection.stop();
                         ^

TypeError: queue.connection.stop is not a function
    at Object.execute (/home/container/src/commands/Music/skip.js:33:23)
    at /home/container/src/events/messageCreate.js:258:12
    at /home/container/node_modules/mongoose/lib/model.js:5074:18
    at processTicksAndRejections (node:internal/process/task_queues:78:11)

why do i get this error?

neon ibex

you should use queue.connection.destroy()

rare cosmos

for a skip command? xd

neon ibex

do you want just skip nowplaying?

rare cosmos

yes like skip to the next song in queue

neon ibex

than audioPlayer.stop()

rare cosmos

where does audioPlayer come from

neon ibex

Hm...in v13 you should use audioPlayer to play song.

rare cosmos

o_0

neon ibex
rare cosmos

but like i have this in my play command

            const stream = ytdl(song.url, {filter: 'audioonly'});
            const player = createAudioPlayer();
            let resource = createAudioResource(stream, { inputType: StreamType.Arbitrary });
            player.play(resource);
            queue.connection.subscribe(player);
            player.on(AudioPlayerStatus.Idle, () => {
                queue.songs.shift();
                play(queue.songs[0]);
            });
neon ibex

than player.stop() emit AudioPlayerStatus.Idle than skip the song

carmine timber
robust knot

channel.join().then(connection => {
message.channel.send("La richiesta è stata inviata");
const dispatcher = connection.play('audios/private.mp3');
});
i have this piece of code and i need when the bot finishes running the mp3 file to exit the voice channel. how do i do that ?

verbal moth

Is there something that shows me whats changing in djs v13 ?

neon ibex
spare wave
neon ibex
rare cosmos

how do i set the volume of music?

neon ibex
rare cosmos
neon ibex
rare cosmos

so if i do queue.connection.state.subscription.player.pause(); for pausing
then i do queue.connection.state.resource.volume.setVolume(volume); for the volume correct?

neon ibex

audioPlayer.state.resource.volume.setVolume(volume)

audioPlayer is queue.connection.state.subscription.player

neon ibex
spare wave
ytdl.raw(this.url, {
                o: '-',
                q: '',
                f: 'best[ext=webm+acodec=opus+asr=44100]/bestaudio',
                r: '100K',
            }, { stdio:['ignore', 'pipe', 'ignore'] });``` I used asr 44100, it greatly reduce my memory usage using youtube-dl-exec. If using 48000 like in example, the memory rise
neon ibex

Thanks

now I tested the my bot, the memory use amount of the bot process does not decrease even if youtube-dl is normally terminated and the song finishes 😦

It started at 15% and increased very quickly, less than two hours to 37%.

spare wave

48min song, using process.memoryUsage.rss() to measure

neon ibex
rss: 385437696
heapTotal: 298512384
heapUsed: 282292232
external: 21525979
arrayBuffers: 13167248

result of process.memoryUsage()

spare wave

367mb 👀

neon ibex

After the bot start, it maintained about 150mb until the song function started.

rss: 408309760
heapTotal: 323153920
heapUsed: 305424776
external: 17495544
arrayBuffers: 10436483

now result of process.memoryUsage()

spare wave

Is bad, if rising every minute

neon ibex

that's right 😦

valid lion

CAN ANYONE JOIN MY SERVER

neon ibex
rss: 450826240
heapTotal: 364834816
heapUsed: 343908864
external: 20489840
arrayBuffers: 9121543
valid lion

MY SERVER NAME IS - WE CODERS

spare wave
rare cosmos

this isnt printing anything to console only ""

function filter(msg) {
    const pattern = /^[0-9]{1,2}(\s*,\s*[0-9]{1,2})*$/;
    return pattern.test(msg.content);
}

message.channel.activeCollector = true;
const response = await message.channel.awaitMessages({ filter, max: 1, time: 30000, errors: ["time"] });

const choice = resultsEmbed.fields[parseInt(response.first()) - 1].name;
console.log(`"${choice}"`)
valid lion

CAN YOU JOIN MY SERVER

neon ibex
spare wave

what is your youtube-dl argument? Try changing it to asr 44100

neon ibex

before I was use

{
    o: '-',
    q: '',
    f: 'bestaudio[ext=webm+acodec=opus+asr=48000]/bestaudio',
    r: '100K',
}

in example

{
    o: '-',
    q: '',
    f: 'bestaudio[filesize<30M+ext=webm+acodec=opus+asr=44100]/bestaudio[filesize<30M]',
    r: '100K',
}

now I test this. Is it correct argument?

spare wave

remove filesize first and see. Because I dont have filesize and memory is ok

neon ibex

Bot is using it on another server now, so we will test it later.

neon ibex
spare wave

3hrs+ yes, memory usage stay at 84-85mb like screenshot

rare cosmos

how can i log if my bot was kicked/disconnected from a voice channel

neon ibex
minor spindle

Hey i tried to do whatever i can but i can never get to the ready part, throws Did not enter state ready within 10000ms

client.on("interactionCreate", async (interaction) => {
    // Reply with comment received
    console.log(interaction)
    await interaction.reply(`processing`);
    let channel = interaction.member.voice.channel
    let connection = await joinVoiceChannel({
        channelId: channel.id,
        guildId: channel.guild.id,
        adapterCreator: channel.guild.voiceAdapterCreator,
    })

    connection.on("debug", console.log);
    connection.on("error", console.error);

    await entersState(connection, VoiceConnectionStatus.Ready, 1000 * 10)
    console.log("ready")
});

Really appreciate some help, have been brain wracking for about 6 hours now

EDIT: To clarify the bot joins the channel but still no ready from code

neon ibex

My codes are not exactly the same way you are. I'm sorry I didn't help you.

undone epoch

how does seeking work in new discord.js/voice?

neon ibex

seeking?

neon ibex
undone epoch

in the v12 version it used to be called seek

neon ibex

Sorry, I don't know how to do that 😦

spare wave
neon ibex

thanks

oh that's sampling frequency

vocal valley

48000 is the sampling frequency discord uses

spare wave

The rare yoda appeared. Planning to update the dep this weekend hydrabolt? the typing bug me sometime

minor spindle
scenic sapphire

I have a lot of this in my code

const voice_connection = client.voice?.connections.find(c => c.voice?.guild.id === guild_object.id);

and I cannot understand what to do with the adapters in djs13, is there anything online to help me ?

narrow abyss

Hello everyone, is it possible to make my bot play music for my server. I can't get it to join a vocal Stage

subtle granite

If I just want to receive voiceStateUpdate, I need the library or not ?

neon ibex
neon ibex
lost thicket

okay so i have a StageChannel and a StageInstance, how can I get my bot to actually join the channel? sorry this is probably very obvious but there's no documentation about Stage Channels on discordjs.guide and nothing I can find in the docs.

placid canyon

Hey, does anybody know how to fix the problem with discordjs / ytdl-core when trying to play an youtube stream?

lost thicket
placid canyon

I tried using ytdl-core-discord just like before but this module doesnt support v13 so that doesnt work this time xD

glad tulip

Does anyone have idea why my bot won't play sound? The path to the resource is correct and I checked to make sure the file is not corrupted or anything.

    private static getVoiceChannel(interaction: CommandInteraction) {
        const voiceChannel = (interaction.member as GuildMember).voice.channel;
        /* This will play a youtube video and should be saved but switching to a .mp3 for clips */
        return voiceChannel
    }

    static connectToChannel(interaction: CommandInteraction): VoiceConnection {
        const voiceChannel = this.getVoiceChannel(interaction)
        if (!voiceChannel) {
            throw new MusicError('Unable to connect to voice channel')
        }
        const conn = joinVoiceChannel({
            channelId: voiceChannel?.id!,
            guildId: voiceChannel?.guild.id!,
            adapterCreator: voiceChannel?.guild.voiceAdapterCreator as DiscordGatewayAdapterCreator,
        })

        return conn
    }

    static playFile(interaction: CommandInteraction, path: string) {
        const conn = this.connectToChannel(interaction)
        const resource = createAudioResource(path)
        const player = createAudioPlayer()
        
        player.play(resource)
        player.on(AudioPlayerStatus.Idle, () => {
            console.log('The audio player has stopped playing')
        })
        player.on(AudioPlayerStatus.Playing, () => {
            console.log('The audio player has started playing')
        })
        player.on('error', error => {
            console.error(`Error: ${error.message} with resource ${error.resource.metadata}`)
        })
        
        conn.subscribe(player)

        interaction.reply({content: 'Playing.'})
    }
placid canyon
glad tulip
placid canyon

implement these functions and then try playing audio:

            connection.on('stateChange', (oldState, newState) => {
                console.log(`Connection transitioned from ${oldState.status} to ${newState.status}`);
            });

            player.on('stateChange', (oldState, newState) => {
                console.log(`Audio player transitioned from ${oldState.status} to ${newState.status}`);
            });
placid canyon
lost thicket

how can I get a bot to join a stage channel with an active StageInstance?

undone epoch

How to seek in the new discord voice

placid canyon
undone epoch

skip to a specific minute in the song

or the audio playing anyways

subtle granite

that depends more on the lib you use, to play the music

spare snow
lost thicket

how can I get a bot to join a stage channel with an active StageInstance? i've searched StackOverflow and asked this twice before lol but does anyone have an answer

undone epoch
spare snow
placid canyon

Hey, does anybody know how to fix the problem with discordjs / ytdl-core when trying to play an youtube stream? When Im playing audio with ytdl and discordjs new voice the bot joins perfectly, plays for 2 seconds (the amout of time I bufferd) or so and then instantly leaves

lost thicket

getting error:

Type 'InternalDiscordGatewayAdapterCreator' is not assignable to type 'DiscordGatewayAdapterCreator'
scenic sapphire

I use getVoiceConnection to get the voice from the current guild but then when I try voice_connection.channel but it is removed. How can I access the channel my bot is connected too ?

scenic sapphire
placid canyon
lost thicket
placid canyon
scenic sapphire

blobreach

placid canyon
lost thicket
placid canyon

Lets stop this before we get kicked for spamming xD

lost thicket
placid canyon

dumb question but what does it say if you look at the error of the ide

lost thicket

the exact same

shadow tundra

message.member.voice.channel.join() where can i find this in v13?

lost thicket
shadow tundra

ty for answering me twice xD >.< shy

lost thicket

i answered you twice because you asked twice xD

carmine timber
lost thicket

It is a issue of voice module not updated to discord api types @0.22.

shadow tundra

so do i nneed to adjust my Code ?? in oder to play stuff or is tis working as it was in the past?

nvm i just saw the extras on that page xD

calm charm

Hello, can i listen user voice ?

and how can i unmute the bot ?

shadow tundra

if (guildMember.voice) will this return boolean if that member is or isn't in a voiceChannel??

sacred cove

why does <VoiceChannel>.bitrate return NaN

teal marten

Why <VoiceChannel>.bitrate and <VoiceChannel>.userLimit return undefined

quasi chasm

error: ReferenceError: member is not defined at Client.<anonymous> (C:\Users\Administrador\Downloads\flyre@lastest (1)\index.js:88:25) at Client.emit (node:events:406:35) at MessageCreateAction.handle (C:\Users\Administrador\Downloads\flyre@lastest (1)\node_modules\discord.js\src\client\actions\MessageCreate.js:23:14) at Object.module.exports [as MESSAGE_CREATE] (C:\Users\Administrador\Downloads\flyre@lastest (1)\node_modules\discord.js\src\client\websocket\handlers\MESSAGE_CREATE.js:4:32) at WebSocketManager.handlePacket (C:\Users\Administrador\Downloads\flyre@lastest (1)\node_modules\discord.js\src\client\websocket\WebSocketManager.js:345:31) at WebSocketShard.onPacket (C:\Users\Administrador\Downloads\flyre@lastest (1)\node_modules\discord.js\src\client\websocket\WebSocketShard.js:443:22) at WebSocketShard.onMessage (C:\Users\Administrador\Downloads\flyre@lastest (1)\node_modules\discord.js\src\client\websocket\WebSocketShard.js:300:10) at WebSocket.onMessage (C:\Users\Administrador\Downloads\flyre@lastest (1)\node_modules\ws\lib\event-target.js:132:16) at WebSocket.emit (node:events:394:28) at Receiver.receiverOnMessage (C:\Users\Administrador\Downloads\flyre@lastest (1)\node_modules\ws\lib\websocket.js:970:20) at Receiver.emit (node:events:394:28) at Receiver.dataMessage (C:\Users\Administrador\Downloads\flyre@lastest (1)\node_modules\ws\lib\receiver.js:517:14) at Receiver.getData (C:\Users\Administrador\Downloads\flyre@lastest (1)\node_modules\ws\lib\receiver.js:435:17) at Receiver.startLoop (C:\Users\Administrador\Downloads\flyre@lastest (1)\node_modules\ws\lib\receiver.js:143:22) at Receiver._write (C:\Users\Administrador\Downloads\flyre@lastest (1)\node_modules\ws\lib\receiver.js:78:10)
code:

subtle granite

you still don't define your member

also read guide in pins

quasi chasm

i read it but i dont find the error :/

thats mi client.on

subtle granite

if you don't know how to define member you should learn some js #resources

also the new voice module works different than in v12 - see pins

quasi chasm

bruh

obtuse cradle
shadow tundra

where can i find all these commands ?

dispatcher.resume()
dispatcher.skip()```
subtle granite

guide in pins

things changed in new voice module

shadow tundra

searching for exact 3 methods can be painful ... i guess i have to take that

subtle granite

there are lots of changes in the new module so I highly recommend you read the guide

shadow tundra

i alredy have it working i just need to implement these commands

subtle granite

well for skip you can just unsubscribe or subscribe the next player

shadow tundra

ty

shadow tundra

i guess this is the problem cause everything else is working as intended any sugestions?
var stream = createAudioResource(`/Playlist/${filemp3}.mp3`)

icy maple
shadow tundra

yes

icy maple

Can you try passing in a Readable stream instead?

fs.createReadStream("…")

shadow tundra

I found my problem I was running this after the code i provided
const resource = createAudioResource(stream, { inputType: StreamType.Arbitrary })

icy maple

Ah, that makes sense

shadow tundra

is there any way to control the volume ?? as in previous version dispatcher.setVolume(volume);

undone epoch

Ik i asked alot but is there a way to seek or is the feature removed?

icy maple

It was removed

You should seek when getting the stream. Ik ytdl-core gives a seek option

undone epoch

idk how ill search it, Thanks so much

neon ibex

is there any optimize option for youtube-dl-exec?

opaque shore

Does anybody know what this error means? I'm trying to get my bot to play music in a VC, but I keep getting this error:

        const timeout = setTimeout(() => reject(new Error(`Did not enter state ${status} within ${maxTime}ms`)), maxTime);
                                                ^

Error: Did not enter state ready within 20000ms
neon ibex
willow crown

im trying to have the bot play a youtube link, and it joins the voice channel, but nothing plays, what should i do?

spare wave

check the intents first, that what I would go first

willow crown
spare wave
Encryption packages

    sodium

(best performance)
libsodium-wrappers
tweetnacl``` installed 1 of this, I recommend libsodium-wrappers
willow crown
spare wave

It is ytdl error, not the lib error

autumn pebble

help me the play function is not working

no errors though

willow crown

how can I make the audio quality better?

scenic sapphire

where can I find user.presence in djs13?

subtle granite

hello is our old codes of music cant work in djs v 13

rustic temple
rustic temple
subtle granite

DiscordAPIError: Unknown Message

        .setTitle('Começando a tocar')
        .setThumbnail(song.thumbnail)
        .setDescription(`
        Nome: ${song.title}
        Pedido por ${song.requester}
        Vizualizações: ${song.views}
        Duração: ${timeString}`)
         interaction.editReply({
            embeds: [noiceEmbed]
        })```
fervent estuary

not voice related

subtle granite

? ;-;

cerulean grove

any way to do seek with v13?

distant trout
let voice = message.member.voice.channel;
voice.join()

not work 😦 help me, brothers

fervent estuary

read the documentation/guide

distant trout

i can not find

v13 changed everything

fervent estuary
distant trout

need install new library now?

fervent estuary

yeh

distant trout

thanks you

@fervent estuary help me again, please. i not find "needed method". I am english bad, sorry

const connection = await connectToChannel(channel);
                connection.subscribe(player);
                message.reply('Playing now!')

this?

fervent estuary
distant trout

thanks, i see

@fervent estuary Wooow 4zaDalaran

thanks you very much

fervent estuary

👌

cerulean grove

is there no way to seek to specific time with v13?

fervent estuary

you can use ffmpeg

cerulean grove

hmm ok

cold geode

Who can explain why <AudioPlayer>.on(AudioPlayerStatus.Idle) may be called multiple times?

fervent estuary

always when the audioPlayer idles (after a resource ends for example) that is emitted

cold geode

This is a debug for playing 1 song on repeat (2-3 times)

fervent estuary

did it log

to {"status":"playing","missedFrames":0,"playbackDuration":0,"resource":true,"stepTimeout":false}``` at once?
rare cosmos

how can i make my bot leave a channel

fervent estuary

VoiceConnection.destroy()

rare cosmos

without it having a queue

cold geode
(node:2086588) MaxListenersExceededWarning: Possible EventEmitter memory leak detected. 11 idle listeners added to [AudioPlayer]. Use emitter.setMaxListeners() to increase limit
(Use `node --trace-warnings ...` to show where the warning was created)
(node:2086588) MaxListenersExceededWarning: Possible EventEmitter memory leak detected. 11 error listeners added to [AudioPlayer]. Use emitter.setMaxListeners() to increase limit

:(
<AudioPlayer>.setMaxListeners(Infinity)?

fervent estuary

you have a memory leak

i guess thats the reason for ur logs looking like that

cold geode

How can you fix this?

fervent estuary

so youre re-attaching a listener somewhere in a loop

you will have to trace it down urself

cold geode
rare cosmos

how can i get the voiceconnection tho

cold geode

getVoiceConnection(guildId)

cold geode
rare cosmos

so i can define it like this?

const voice = getVoiceConnection(guildId);

voice.connection.destroy();
scarlet thistle
rare cosmos how can i get the voiceconnection tho
const connection = joinVoiceChannel({
            channelId: channel.id,
            guildId: channel.guild.id,
            adapterCreator: channel.guild.voiceAdapterCreator
          });
serverQueue.voiceConnection = connection;

serverQueue.voiceConnection.destroy() in your leave command

fervent estuary
fervent estuary
cold geode
fervent estuary

so just call voice.destroy with that code

voice.connection isnt a thing

rare cosmos

oh ok

TypeError: Cannot read property 'destroy' of undefined

fervent estuary
rare cosmos

const connection = getVoiceConnection(channel.guild.id); is this correct?

cold geode
rare cosmos

ty it works

what is this in v13 serverQueue.connection.dispatcher.streamTime

scarlet thistle

I can't still find a way to know when the player finished playing like .on("finish") in v12. Is there anyway beside AudioPlayerStatus.Idle

cold geode
cold geode
rare cosmos
cold geode `<AudioResource>.playbackDuration`
                const passedTimeInMS = serverQueue.connection.state.subscription.player.playbackDuration;
                
                const passedTimeInMSObj = {
                    seconds: Math.floor((passedTimeInMS / 1000) % 60),
                    minutes: Math.floor((passedTimeInMS / (1000 * 60)) % 60),
                    hours: Math.floor((passedTimeInMS / (1000 * 60 * 60)) % 24)
                };

this isnt working :/

neon ibex
const passedTimeInMS = serverQueue.connection.state.subscription.player.state.resource.playbackDuration;

serverQueue.connection.state.subscription.player is AudioPlayer

cold geode
neon ibex

I experienced that the memory usage of the bot process increased dramatically when the long song (at least an hour) was played and ended. I'm using youtube-dl-exec.

Are there any people who are experiencing the same problem or know how to solve it?

carmine timber

@vocal valley I have done it, now you can test its functionality before merging.

carmine timber

Ok 👍

rare cosmos
carmine timber
neon ibex

is there any difference about <AudioPlayer>.stop() and <AudioPlayer>.stop(true) ?

vocal valley

stop() will play 100ms of silence after stopping to stop a weird glitchy sound in the discord client due to the stream stopping unexpectedly

stop(true) will just stop, but you might hear a weird sound in the discord client

rare cosmos

serverQueue.connection.state.subscription.player.state.resource.playbackDuration

carmine timber
honest shuttle

Is there a way to get a connection's channel?

Also am I the only one who doesn't see anything related to <connection>.state.subscription in the docs?

rare cosmos
                if(connection.state.status === VoiceConnectionStatus.Destroyed) return;
                              ^

TypeError: Cannot read property 'state' of undefined
vocal valley
vocal valley

so you'd do something like

if (state.status !== VoiceConnectionStatus.Destroyed && state.subscription) {
  // state.subscription is defined here
}

the first conditional check is to get typescript to accept that the state can have a subscription property

although if you aren't using TS, it's equally acceptable to just do if (state.subscription)

queen storm

I could not join the voice channel: TypeError: channel.join is not a function

queen storm
whole flare
queen storm
placid canyon

Hey, does anybody know how to fix the problem with discordjs / ytdl-core when trying to play an youtube stream? When Im playing live videos with ytdl and discordjs's new voice the bot joins perfectly, plays for 2 seconds (the amout of time It bufferd) or so and then instantly leaves. (normal youtube videos work perfectly fine)

placid canyon
north scaffold

how do i do this in v13? im trying to record the vc channel. this is how i did it in v12

const receiver = connection.receiver.createStream(message.member, {
        mode: "pcm",
        end: "silence",
    });```
here i get ``TypeError: Cannot read property 'createStream' of undefined``
carmine timber
north scaffold
carmine timber
north scaffold
carmine timber
north scaffold

is that a yes ? haha

carmine timber
north scaffold

thanks

@vocal valley do you have any idea regarding how long it will be until AudioReceive will be completed?

vocal valley

I am hoping by the end of today or tomorrow

proud spindle

I'm getting the error Type 'InternalDiscordGatewayAdapterCreator' is not assignable to type 'DiscordGatewayAdapterCreator'. when calling joinVoiceChannel with interaction.guild.voiceAdapterCreator as the adapterCreator, how do I fix this?

north scaffold
proud spindle

alright, thanks! do I have to uninstall and reinstall or is just updating fine?

spare wave

npm install @discordjs/voice@latest will do

proud spindle

thank you!

subtle granite
serverQueue.loop = !serverQueue.loop;``` why this cant work
pulsar plinth

is there a way i can make a user join a channel?

neat comet

How do I join a voice channel.

neon ibex
vocal valley
wintry lily

how can i join my discord bot on stage channel

hushed narwhal

Any idea how I can check the number of users connected to a voice channel?

hushed narwhal
wintry lily
hushed narwhal

Do you have the @discordjs/voice library installed?

wintry lily

yeah

but ı dont understand how i can join my bot on stage

hushed narwhal

I believe interaction.member.voice includes stage presences.

joinVoiceChannel should work for both Voice and Stage channels.

vocal valley
hushed narwhal
vocal valley

i think so!

wintry lily

const connection = joinVoiceChannel({
    channelId: channel.id,
    guildId: channel.guild.id,
    adapterCreator: channel.guild.voiceAdapterCreator,
});```

Sorry but believe me I still don't understand how to use it
fleet rampart
    channelId: channel.id,
    guildId: channel.guild.id,
    adapterCreator: channel.guild.voiceAdapterCreator,
});```

What's the adapterCreator field for?
subtle granite

resource.playStream.once('error', onStreamError);
^

TypeError: Cannot read property 'once' of undefined

grizzled sun

um why does the player state changes to autopaused. like it goes from idle to buffering to playing to autopaused in 1 sec

grizzled sun
vocal valley

Did you remember to subscribe your voice connection to the player?

grizzled sun

yes

vocal valley

well then it means the connection isn't ready

grizzled sun

hmm

undone epoch

the bot just plays for one minute then gives me this error

    at connResetException (node:internal/errors:691:14)
    at TLSSocket.socketCloseListener (node:_http_client:407:19)
    at TLSSocket.emit (node:events:406:35)
    at node:net:672:12
    at TCP.done (node:_tls_wrap:580:7)```

anyone know why?

supple dust

Hi, i'm need help. My song don't play but the code is correct i think

 await joinVoiceChannel({
                    channelId: queueConstruct.voiceChannel.id,
                    guildId: queueConstruct.voiceChannel.guild.id,
                    adapterCreator: queueConstruct.voiceChannel.guild.voiceAdapterCreator

                });
                var connection = createAudioPlayer({
                    behaviors: {
                        noSubscriber: NoSubscriberBehavior.Pause,
                    }
                });
                queueConstruct.connection = connection;      
                    
                play(message.guild, queueConstruct.songs[0]);
async function play(guild, song) {
    const serverQueue = queue.get(guild.id); // On récupère la queue de lecture
    if (!song) { // Si la musique que l'utilisateur veux lancer n'existe pas on annule tout et on supprime la queue de lecture
            queue.delete(guild.id);
            setTimeout(function() {
                serverQueue.voiceChannel.leave();
            }, 300000)
            return;
        }

    if(serverQueue.loop === true) {
        serverQueue.songs.push(song);
    }
    // On lance la musique
    var connection = await getVoiceConnection(serverQueue.voiceChannel.guild.id);
    await connection.subscribe(serverQueue.connection);
    serverQueue.ressource = await createAudioResource(ytdl(song.url, {filter: "audio", quality: "highestaudio"}), { inlineVolume: true });
    serverQueue.ressource.volume.setVolume(1); // On définie le volume
    await serverQueue.connection.play(serverQueue.ressource);
        serverQueue.connection.on(AudioPlayerStatus.Idle, () => { // On écoute l'événement de fin de musique   
                serverQueue.songs.shift();
                play(guild, serverQueue.songs[0]);
        });
        serverQueue.connection.on("error", error => console.error(error));

    serverQueue.textChannel.send({ content: `Démarrage de la musique: **${song.title}**`});
}

If somebody have the solution ping me please

grizzled sun
subtle helm

hello! i am a little bit confused with the new docs.
In v12 i was able to see, if the member who wrote the command was in a voicechannel.
in v13 can i also get the voicechannel from an interaction? like interaction.voicechannel doesn't work
thanks !

grizzled sun

interaction.member.voice.channel

subtle helm
grizzled sun

np

subtle helm

May i bother you one more time?
The bot is joining and leaving the channel as intented, but he won't play the file

const connection = joinVoiceChannel({
      channelId: interaction.member.voice.channel.id,
      guildId: interaction.member.voice.channel.guildId,
      adapterCreator: interaction.member.voice.channel.guild.voiceAdapterCreator,
    });
    const player = createAudioPlayer();
    const resource = createAudioResource(`./audio/gong.mp3`);
    player.play(resource);
    await new Promise(resolve => setTimeout(resolve, workoutDuration));
    connection.destroy();

i honestly think i set the right permissions, and those are my npm packages

├── @discordjs/opus@0.5.3
├── @discordjs/voice@0.5.6
├── discord.js@13.0.1
├── ffmpeg-static@4.4.0
└── libsodium-wrappers@0.7.9

EDIT, i had to subscribe

verbal moth

AudioPlayerError: aborted what is it ?

jolly mason

My bot randomly stops playing audio

node:events:371
      throw er; // Unhandled 'error' event
      ^

AudioPlayerError: aborted
    at connResetException (node:internal/errors:691:14)
    at TLSSocket.socketCloseListener (node:_http_client:407:19)
    at TLSSocket.emit (node:events:406:35)
    at node:net:672:12
    at TCP.done (node:_tls_wrap:580:7)
Emitted 'error' event on AudioPlayer instance at:
    at Encoder.onStreamError (D:\! IDE\Discord bots\! Crysto rewrite\node_modules\@discordjs\voice\dist\audio\AudioPlayer.js:213:22)
    at Object.onceWrapper (node:events:514:26)
    at Encoder.emit (node:events:406:35)
    at emitErrorNT (node:internal/streams/destroy:157:8)
    at emitErrorCloseNT (node:internal/streams/destroy:122:3)
    at processTicksAndRejections (node:internal/process/task_queues:83:21)```
verbal moth

same AudioPlayerError: aborted if someone know what is it 🙏

subtle granite
verbal moth
jolly mason

I'm using ytdl-core-discord instead of ytdl-core if that matters

undone epoch

im using ytdl-core and still same thing soo

vocal valley

ytdl-core/ytdl-core-discord/discord-ytdl-core will all suffer from the same issues

i cannot recommend using any of them until good fixes for it are found

i recommend that people use youtube-dl instead, or ffmpeg with youtube video download URLs

shadow tundra

im using ytdl-core and it works perfect fine for me i even mixxed it up with a jukebox but i gotta say it took me a long time and its not finished yet but what i have works perfect

rose helm
harsh adder
node:events:371
      throw er; // Unhandled 'error' event
      ^

AudioPlayerError: Status code: 403
    at ClientRequest.<anonymous> (/app/node_modules/miniget/dist/index.js:210:27)
    at Object.onceWrapper (node:events:514:26)
    at ClientRequest.emit (node:events:394:28)
    at HTTPParser.parserOnIncomingClient [as onIncoming] (node:_http_client:621:27)
    at HTTPParser.parserOnHeadersComplete (node:_http_common:128:17)
    at TLSSocket.socketOnData (node:_http_client:487:22)
    at TLSSocket.emit (node:events:394:28)
    at addChunk (node:internal/streams/readable:312:12)
    at readableAddChunk (node:internal/streams/readable:287:9)
    at TLSSocket.Readable.push (node:internal/streams/readable:226:10)
Emitted 'error' event on AudioPlayer instance at:
    at OggDemuxer.onStreamError (/app/node_modules/@discordjs/voice/dist/audio/AudioPlayer.js:213:22)
    at Object.onceWrapper (node:events:514:26)
    at OggDemuxer.emit (node:events:406:35)
    at emitErrorNT (node:internal/streams/destroy:157:8)
    at emitErrorCloseNT (node:internal/streams/destroy:122:3)
    at processTicksAndRejections (node:internal/process/task_queues:83:21) {
  resource: <ref *4> AudioResource {
    playbackDuration: 0,
    started: false,
    silenceRemaining: -1,
    edges: [
      <ref *1> {
        type: 'ffmpeg ogg',
        to: Node {
          edges: [ [Object], [Object], [Object] ],
          type: 'ogg/opus'
        },
        cost: 2,
        transformer: [Function: transformer],
        from: Node { edges: [ [Object], [Circular *1] ], type: 'arbitrary' }
      },
      <ref *2> {
        type: 'ogg/opus demuxer',
        to: Node { edges: [ [Object] ], type: 'opus' },
        cost: 1,
        transformer: [Function: transformer],
        from: Node {
          edges: [ [Circular *2], [Object], [Object] ],
          type: 'ogg/opus'
        }
      }
    ],
    playStream: OggDemuxer {
...```
vocal valley
vocal valley
rose helm

:/ guess I don't really see a way around writing a thread in py to handle extractions.

harsh adder
vocal valley

have you tried the examples in the repo?

harsh adder
vocal valley have you tried the examples in the repo?
.eval (async () => {
const ytdl = require('ytdl-core');
const {
    AudioPlayerStatus,
    StreamType,
    createAudioPlayer,
    createAudioResource,
    joinVoiceChannel,
} = require('@discordjs/voice');

// ...

const connection = joinVoiceChannel({
    channelId: message.member.voice.channel.id,
    guildId: message.guild.id,
    adapterCreator: message.guild.voiceAdapterCreator,
});

const stream = ytdl('https://music.youtube.com/watch?v=MLH4IWgWmyE&feature=share', { filter: 'audioonly' });
const resource = createAudioResource(stream, { inputType: StreamType.Arbitrary });
const player = createAudioPlayer();

player.play(resource);
connection.subscribe(player);

player.on(AudioPlayerStatus.Idle, () => connection.destroy());
})();```

I tried to run it with this code but it didn't work

vocal valley

try the code in the examples folder

harsh adder

where is the examples folder?

subtle granite

pins

supple dust

@harsh adder i think is that

fallow locust

I'm trying to make a bot that says spoke in the console when a specific person speaks or just makes enough noise (That's why it's comparing id's). I downloaded an external library (discord.js/voice) but it's not detecting my voice. I messed up somewhere and the console keeps telling me creatVoiceReceiver is probably the wrong thing to use.

I think there's a larger issue than creatVoiceReceiver not being defined, I'm probably using the wrong thing altogether. What should I do to get it to hear my voice?

vocal valley

@fallow locust voice receive is being reworked, PR should be ready tomorrow 👀

i wouldnt recommend using voice receive as it is now

for reference, the new receive will look something like:

const connection = joinVoiceChannel(options);

connection.receiver.speaking.on('start', userId => {
  const stream = connection.receiver.subscribe(userId);
  stream.pipe(somewhere);
  console.log(userId, 'started speaking');
});

connection.receiver.speaking.on('end', userId => {
  console.log(userId, 'stopped speaking');
});

the new voice receive basically goes back to using user IDs in subscriptions, rather than forcing you to resolve the user ID to a SSRC yourself

harsh adder

@vocal valley

harsh adder
vocal valley

someone else also posted it above

fallow locust
vocal valley

atm no 😅 but it should land either tomorrow or tuesday depending on review speed

fallow locust

Cool, thanks

harsh adder
vocal valley

Np

supple dust

Hi, my bot join but don't play the music in the channel. My code : ```js
var connection = await getVoiceConnection(serverQueue.voiceChannel.guild.id);
await connection.subscribe(serverQueue.connection);

await ytdl(song.url, {filter: "audio", quality: "highestaudio"}).pipe(fs.createWriteStream("song.mp3"));
serverQueue.ressource = createAudioResource((fs.createReadStream("song.mp3")),{ inlineVolume: true });
serverQueue.ressource.volume.setVolume(1); // On définie le volume
await serverQueue.connection.play(serverQueue.ressource);
    serverQueue.connection.on(AudioPlayerStatus.Idle, () => { // On écoute l'événement de fin de musique   
            serverQueue.songs.shift();
            play(guild, serverQueue.songs[0]);
    });
    serverQueue.connection.on("error", error => console.error(error));

serverQueue.textChannel.send({ content: `Démarrage de la musique: **${song.title}**`});
If someone have the solution, thank you
hushed narwhal
neon ibex

is there someone find memory leak after using youtube-dl-exec?

memory usage is increased greatly when I stop the song.
especially it can easily find when I play long song.

neon ibex
supple dust
neon ibex

what's your problem?

neon ibex

maybe it's somethig wrong in your code

supple dust
await joinVoiceChannel({
                    channelId: queueConstruct.voiceChannel.id,
                    guildId: queueConstruct.voiceChannel.guild.id,
                    adapterCreator: queueConstruct.voiceChannel.guild.voiceAdapterCreator

                });
                var connection = createAudioPlayer({
                    behaviors: {
                        noSubscriber: NoSubscriberBehavior.Pause,
                    }
                });
                queueConstruct.connection = connection;      
                    
                play(message.guild, queueConstruct.songs[0]);
last mist

playing .mp3 files is "off again". Last time I checked it was working but that was prior to the official release of v13. I see two errors I haven't seen before.Cannot find module 'D:\Repos\tleylanBot\node_modules@discordjs\opus\prebuild\node-v93-napi-v3-win32-x64-unknown-unknown\opus.node'

Cannot find module 'opusscript'

I have never used opusscript before did something change?

neon ibex

um...how about uninstall and reinstall voice module

last mist

let me try it

I also reinstalled opus while I was at it. I still have an error which seems to occur in my call to createAudioResource. Also am I correct in assuming that prism-media: 1.3.1 is automatically installed as dependency because I don't explicitly do that.

Ah I see that "reinstall" wasn't directed towards me... in any case no harm

oh my gosh... the documentation changed (or must have). I guess it is somewhat to be expected. Went back to the simplest example and it is working now. Something in the options for the createAudioResource has changed I suspect.

okay not 100% as from this example from the docs but identical except for the mp3 file.

this works:

let resource = createAudioResource(join(__dirname, 'file.mp3'));

this fails:

// Will use FFmpeg with volume control enabled
resource = createAudioResource(join(__dirname, 'file.mp3'), { inlineVolume: true });
resource.volume.setVolume(0.5);

it isn't the options per se because I tried with inputType and that worked fine. Seems related to inlineVolume at this moment.

rose helm
neon ibex is there someone find memory leak after using youtube-dl-exec?

the exec spawns a child process of ytdl which is python. Child process usage is added to the residential set iirc which can inflate usage pretty high. If you don't properly send a kill signal to child processes, they can stay alive and retain memory usage until you hit a seg fault. That happened to me even though I believe I handled everything properly. I decided to give myself less of a headache and just switched back to ytdl-core

like node, python has a bit of overhead in terms of memory usage. spawning ytdl over and over is also pretty heavy in terms of performance as it would have to compile the regular expressions

neon ibex

But in v13 ytdl-core occured abortes Error in audioplayer

rose helm

what were you setting for your highWaterMark in ytdl

neon ibex

i used just default
and when I use 1<<25 for highWaterMark, it use so large memory

rose helm

1<<25 is way too high, yes

defaults should be fine.
I haven't experienced an abort error before though. Abort errors are on Discord.js' internals end anyways.

Should be unrelated to ytdl

neon ibex

I experienced that error when play long song

rose helm

stream urls can expire after 6h iirc

you'd have to refresh

neon ibex

but it was just 1hour and error occured when about 20m

rose helm

awoowtf

neon ibex

:(

neon ibex
turbid hedge

is there a way to get every voice channel the bot is in (in the cache) and leave it?

tepid stag

bruh lmao

turbid hedge

well, install sodium, libsodium-wrappers or tweetnacl like it says in the error

turbid hedge

?

spare wave
neon ibex thanks for share your experience
            const process = ytdl.raw(this.url, {
                o: '-',
                q: '',
                f: 'best[ext=webm+acodec=opus+asr=44100]/bestaudio',
                r: '100K',
            }, { stdio:['ignore', 'pipe', 'ignore'] });
            if (!process.stdout) {
                reject(new Error('No readable stream'));
                return;
            }
            const stream = process.stdout;
            const onError = (error) => {
                if (!process.killed) {process.kill();}
                stream.resume();
                reject(error);
            };
            process
                .on('spawn', () => {
                    audio.demuxProbe(stream)
                        .then((probe) => resolve(audio.createAudioResource(probe.stream, { metadata: this, inputType: probe.type })))
                        .catch(onError);
                });
        });``` this is what I do for youtube-dl-exec which basically almost same like example, but minor changes
neon ibex

oh okay, thanks!

spare wave

a quick repo made, but as this is only quick repo, expect something not so perfect

neon ibex

:)

spare wave

only objective is to see the memory

neon ibex

💯 👍

north scaffold

Any news with audio receive ? 👀

carmine timber
shut verge

anyone knows about lavalink ?

carmine timber
south lark

How can I make the bot just join the voice channel mmLol

the adapter creator stuff is screwing me over crycat

carmine timber
fallow locust

I updated to v13 and my code stopped working. What should I do to update it?

client.on("voiceStateUpdate", (oldMember, newMember) => {
    const channel = client.channels.cache.get(newMember.channelID);
    if (newMember.id === "277484746265722881") {
        if (!channel) return console.error("The channel does not exist.");
        channel.join().then(connection => {
            console.log("Successfully connected");
            }).catch(e => {
              console.error(e);
         });
    }
});
carmine timber
bleak heart

guys i need help. I cant download @discordjs/opus

subtle granite

hello

my play command cant working

velvet jewel
stoic beacon

why my bot dont join the voice channel

with await channel.join()```
velvet jewel

error?

stoic beacon

but in previous version of discord.js its worked

velvet jewel

the v12 voice is deprecated, check d.js guide for the new ways of using voice

stoic beacon

i cant find the new one (:

help me (:

subtle granite
stoic beacon
subtle granite
stoic beacon
subtle granite
glacial turret

Is there any way to add custom FFmpeg args, or a custom transform stream to the pipeline?

glacial turret

No.

subtle granite
dispatcher.setVolumeLogarithmic(queue.volume / 100);```

why this cant work in djs v13

glacial turret

What is dispatcher? You need access to resource.volume

subtle granite
glacial turret

Mmm, yeah, I saw that. Just curious if there was a way before that. Thanks.

Good timing though, I was about to wrap the libs myself before I saw that lol.

carmine timber
carmine timber

Welcome 😄

pure granite

Why if I install Discord Voice using npm instal @discordjs/voice gives me this error?

code: 'MODULE_NOT_FOUND',
path: 'C:\Users\user\Discord Bot\node_modules\@discordjs\voice\package.json',
requestPath: '@discordjs/voice'

carmine timber
pure granite

it works, thx

vocal valley

@carmine timber i'll re-review your PR once voice receive is done

flat vector

Hi everyone,
I'm trying to play audio in a voice channel in response to a slash command. This is my play command handler. I'm out of ideas about what I'm doing wrong. Anyone has a hint ?
The voice connection works, the player and resource don't generate any error but the audio playback never starts. The player goes from buffering to playing, and from playing to idle state instantaneously.

carmine timber
carmine timber
vocal valley

i believe all that is left to add some documentation, a nice example, and then time for review

carmine timber
flat vector or this https://cdn.discordapp.com/attachments/775079047197491210/77618567772451...

Can you test one thing ??

const prism_media = require('prism-media')
const FFMPEG_OPUS_ARGUMENTS = [
    '-analyzeduration',
    '0',
    '-loglevel',
    '0',
    '-acodec',
    'libopus',
    '-f',
    'opus',
    '-ar',
    '48000',
    '-ac',
    '2',
];
//Put above code at top.

let ffmpeg_instance = new prism_media.FFmpeg({
        args : ['-reconnect', '1', '-reconnect_streamed', '1', '-reconnect_delay_max', '5','-i', sound.url, ...FFMPEG_OPUS_ARGUMENTS ]
    })
let resource = createAudioResource(ffmpeg_instance)
grizzled sun

i tried debugging the connection
it gets ready then sends a heartbeat
after that the state changes to op 6 and ws becomes false

and even entersState doesn't throw anything
which is kinda confusing me

flat vector
carmine timber
flat vector

state() is not a function but connection.state.status is "ready"

carmine timber
carmine timber
grizzled sun

it says get

getter are always used as method not method()

carmine timber
flat vector
carmine timber
grizzled sun
flat vector
carmine timber

I just want to see edges of the resource

flat vector
edges: [
    {
      type: 'ffmpeg ogg',
      to: [Node],
      cost: 2,
      transformer: [Function: transformer],
      from: [Node]
    },
    {
      type: 'ogg/opus demuxer',
      to: [Node],
      cost: 1,
      transformer: [Function: transformer],
      from: [Node]
    }
  ],
carmine timber
flat vector
carmine timber
flat vector

This console.log() of the resource was done right before the 'player.play(resource)' line

carmine timber
spare wave
neon ibex
spare wave

I still on repeating the song

neon ibex

👍 thanks

spare wave

another 9hrs to repeat the songs

pure ledge

how do you get the list of users that joined a voice channel?

turbid hedge

is there a way to get every voice channel the bot is in (in the cache) and leave it?

carmine timber

@turbid hedge

Make sure you have Move Members Permission

supple dust

Hi, my bot join the channel but don't play music and i don't have error. my code : ```js
await joinVoiceChannel({
channelId: queueConstruct.voiceChannel.id,
guildId: queueConstruct.voiceChannel.guild.id,
adapterCreator: queueConstruct.voiceChannel.guild.voiceAdapterCreator

            });
            var connection = createAudioPlayer({
                behaviors: {
                    noSubscriber: NoSubscriberBehavior.Pause,
                }
            });
            queueConstruct.connection = connection;      
                
            play(message.guild, queueConstruct.songs[0]);
async function play(guild, song) {
    const serverQueue = queue.get(guild.id); // On récupère la queue de lecture
    if (!song) { // Si la musique que l'utilisateur veux lancer n'existe pas on annule tout et on supprime la queue de lecture
            queue.delete(guild.id);
            setTimeout(function() {
                if(!serverQueue) {
                    var connection = getVoiceConnection(serverQueue.voiceChannel.guild.id);
                    connection.destroy();
                }
            }, 300000)
            return;
        }

    if(serverQueue.loop === true) {
        serverQueue.songs.push(song);
    }
    // On lance la musique
    var connection = await getVoiceConnection(serverQueue.voiceChannel.guild.id);
    await ytdl(song.url, {filter: "audio", filter: format => format.container === "webm", quality: "highestaudio"}).pipe(fs.createWriteStream("song.webm"));
    serverQueue.ressource = createAudioResource("../song.webm",{ 
        inlineVolume: true,
        inputType: StreamType.WebmOpus
    });
    serverQueue.ressource.volume.setVolume(1); // On définie le volume
    await serverQueue.connection.play(serverQueue.ressource);
    await connection.subscribe(serverQueue.connection);
        serverQueue.connection.on(AudioPlayerStatus.Idle, () => { // On écoute l'événement de fin de musique   
                serverQueue.songs.shift();
                play(guild, serverQueue.songs[0]);
        });
        serverQueue.connection.on("error", error => console.error(error));

    serverQueue.textChannel.send({ content: `Démarrage de la musique: **${song.title}**`});
}
turbid hedge
carmine timber
supple dust

Okay i go try thx

pure ledge
carmine timber
flat vector Still the same behavior

I got it working with this basic code :

const connection = joinVoiceChannel({
            channelId : message.member.voice.channel.id,
            guildId : message.guild.id,
            adapterCreator: message.guild.voiceAdapterCreator
        })
        var url = 'https://www.soundhelix.com/examples/mp3/SoundHelix-Song-1.mp3'
        
        let resource = createAudioResource(url)

        let player = createAudioPlayer()
        player.play(resource)

        connection.subscribe(player)
carmine timber
pure ledge

there is no message involved or is it mandatory?

carmine timber

This will return a Collection, Then you need to figure out a way to get all members ids or name from that

carmine timber
supple dust

always no sound

supple dust
carmine timber
supple dust
carmine timber
supple dust

oh

We can active all intents ?

carmine timber
supple dust

okay ty

carmine timber
supple dust

i will try

supple dust
supple dust

thanks very much

spare snow

Also there's an issue where ffmpeg disconnects and ends the audio stream early iirc

carmine timber
carmine timber
rustic carbon

Hi people, why is it doing this

spare snow
carmine timber
carmine timber
spare snow
spare wave

that memory usage is not accurate at all, each player will spawn a ffmpeg and youtube-dl processes which use more than 100 mb ram combined

rustic carbon
carmine timber Code ??

        const serverQueue = this.client.songs.get(guild);

        // if there is more music
        if (!song) {
            serverQueue.timeout = setTimeout(() => {
                serverQueue.connecttion.destroy();
            }, 10000);
            return;
        }

        // create stream
        const stream = ytdl(song.url, {
            filter: "audioonly",
        });

        /**
         * resource url ytb
         */
        const resource = createAudioResource(stream, {
            inlineVolume: true,
            inputType: StreamType.Arbitrary
        });

        // play resource
        serverQueue.player.play(resource);

        // add event
        serverQueue.player.on(AudioPlayerStatus.Idle, () => {
            song.loop !== true ? serverQueue.songs.shift() : null;
            this._play(message, guild, serverQueue.songs[0]);
        });
spare wave

The thing is when I used 48000, it will go up and when song off, it drop? How do you explain that?

And it the same thing I measure i used?

carmine timber
rustic carbon
carmine timber
supple dust
carmine timber
supple dust

nothing x)

carmine timber

XD

supple dust

nobody reply

but i know the problem it's with Node because the solution is to downgrade node to lts version

But the lts version don't match with discord.js v13

carmine timber
spare wave

for nodejs v16, you need to specify highWaterMark for ytdl-core

supple dust

that i don't know just the solution is the downgrade

subtle granite

So I installed the voice extension, how do I get the bot to connect to a voice channel now?

carmine timber
north scaffold
spare snow
subtle granite
spare snow
carmine timber
subtle granite

Well that just gave me a really complicated error.

spare wave

And if you saying it pass on cpu, My cpu usage doesn't seem to budge. at 11am, I restarted my vps, and when I started the song marathon too

grizzled sun

um what can be the reasons for which a connection can't become ready

spare snow

I just switched to lavalink a while ago

spare snow
carmine timber
grizzled sun

well just for testing I added all intents

carmine timber
grizzled sun

firewall issue hmm
welp idk
because my bot can't seem to join the vc for 3 days for some reason

subtle granite

hello

grizzled sun

idk how bad internet affect it tho

spare snow
subtle granite

is this thing change in djs v13 js message.client.queue.delete(message.guild.id);

carmine timber
grizzled sun

does even queue existed in client class in V12 ?

grizzled sun
carmine timber
grizzled sun

thought so

spare snow
spare snow
carmine timber
grizzled sun

its just simple

const client = new Discord.Client({
intents: ["GUILDS","GUILD_MESSAGES","GUILD_VOICE_STATES"],
})
client.login(token)

grizzled sun
async joinVc(channel,debug=false){
     const d = {channelId:channel.id,
                                             guildId:channel.guildId,
                                             adapterCreator:channel.guild.voiceAdapterCreator ,
                   debug:debug           // group:this.client.user.id
               }
     console.log(d)
        const connection = joinVoiceChannel(d)
        connection.on("debug", console.log)
          connection.on('error', console.error)      
            await entersState(connection,VoiceConnectionStatus.Ready,10000)      
            this.servers.set(channel.guild.id,new ServerManager({connection, channel,voice: this}))
        
       /* catch(error){
           
            connection.destroy() 
            AoiError.consoleError("joinVoiceChannelError",error)
        }*/
    }```
carmine timber
grizzled sun

yes member.voice.channel

tbh I don't have any clue why it doesnt work

it used to work with master branch tho

carmine timber
grizzled sun

I deleted node_modules 4 times already then reinstalled every package

carmine timber
spare wave

no idea, all good here

grizzled sun

i will check it with a different host to see if it's a ip issue or not

carmine timber
spare wave

youtube-dl default to best if no stated

carmine timber
spare wave

and no, I tested, restarted my bot, no any file downloaded

carmine timber
spare wave

It didnt download video, how you download video idk

there, no video

carmine timber
spare wave

image

carmine timber
spare wave

I am not talking about discord audio playback, I am talking about youtube-dl format argument that you supplied

It gets video

spare wave

it is youtube-dl argument

carmine timber
spare wave

for live video, it is used

subtle granite
subtle granite

hello one probleam happen

message.client.queue.delete(message.guild.id);``` this cant work in my codes
carmine timber
summer crow
subtle granite
summer crow
subtle granite

You can, if you attached something to the client anywhere it replicates

summer crow
if (!message.member.voice.channel) return message.reply("🛑 Ah, you need to first join a voice channel for that.");

even if i am in vc it shows me the message
how to fix it

rustic temple

You need GUILD_VOICE_STATES intent

summer crow
flat vector
rustic temple

Yep, exactly, sorry for the error lol

summer crow
const resource = createAudioResource(await ytdl(music.url), {
            inputType: StreamType.WebmOpus
        });
        resource.volume.setVolume(guildMusicQueue.volume / 100);
        player.play(resource);

it shows error Cannot read property 'setVolume' of undefined

wintry lily

I want my discord bot to join the stage channel and give live music 24/7. How can I do it

subtle granite

@carmine timber dm ma pls help kar da bhie

subtle granite

DOESN'T WORK THIS IS HOPELESS

TRYING TO EXECUTE THIS JUST RETURNS AN ERROR WITH THE CHANNEL ID BECAUSE ITS NOT DEFINED, NOT GIVING ANYONE THE PROPER HELP.

stark jacinth

Show some code instead of yelling

subtle granite
const { MessageReaction, Permissions, ClientVoiceManager } = require('discord.js');
const { joinVoiceChannel } = require('@discordjs/voice');
const connection = joinVoiceChannel({
    channelId: channel.id,
    guildId: channel.guild.id,
    adapterCreator: channel.guild.voiceAdapterCreator,
});
const config = require('../config.json');
const ytdl = require('ytdl-core');
module.exports = {
    name: "yt",
    commands: ["yt", "play"],
    description: "Play Music From YouTube.com",
    callback: (message, arguments, text, Discord, client) => {
        connection.joinVoiceChannel()
}
}```
stark jacinth
subtle granite

I had to start from scratch thanks to V13.

stark jacinth

You can’t just copy it and expect it to work like that, define channel.

subtle granite

It is meant to join the channel that the user running the command is joining. How tf do I do that?!

stark jacinth

Pls learn basic js, I’m not going to argue. You don’t define channel anywhere in the code.

subtle granite
stark jacinth

Happens

subtle granite

nvm I think I might know what I'm doing, I'm checking the guide.

earnest mountain

Does anyone know a simple way to get the discordjs voicechannel that the bot is currently connected to? (I do NOT mean the voiceConnection)
I want to find this so that i can check if the bot is alone in a channel. The only way i currently know how to do it is through doing some magic with the 'voiceStateUpdate' event.

subtle granite

nvm, I was wrong, I still need help.

carmine timber
earnest mountain

@carmine timber thank you very much! This is exactly something i was looking for !

honest shuttle

How to determine the status of an audio player? e.g. if paused

glacial turret
wispy trout

how to join to a voice channel

i dont see any guide

rough pawn
wispy trout
rough pawn

I'll use a snippet and explain the code:```js
const voice = require('@discordjs/voice');
voice.joinVoiceChannel({ guildId: message.guild.id, channelId: message.member.voice.channelId, adapterCreator: message.guild.voiceAdapterCreator, debug: true /has more options like selfDeaf and selfMute - they are default of true/});

rough pawn

And "debug" is optional default is false

rough pawn
vocal valley

since /voice is a standalone library, you need adapters to connect it to libraries like discord.js/eris

vocal valley

discord.js v13 provides an adapter for /voice to use, so that when discord.js receives an event that /voice needs, the adapter can pass it on

or if /voice needs to send a message on the main discord gateway, it can use the adapter

spare snow
vocal valley

ty, you can either PR it or i'll remember to add it to my voice receive PR

rough pawn
wispy trout
rough pawn

Like <client>.guilds.cache.get('specified guild id').voiceAdapterCreator

wispy trout
joinVoiceChannel({
       guildId: message.guild.id,
       channelId: canalvoz.id,
       adapterCreator: message.guild.adapterCreator,
       selfDeaf: true,
       debug: true,
})

whats bad, why that error .-.

wispy trout
rough pawn

I think canalvoz = channel

wispy trout
rough pawn
wispy trout
rough pawn

guildId is the same thing <channel>.guild.id

wispy trout

ok lemme try

still the error

rough pawn
wispy trout

im still getting that error

rough pawn

You wrote canalvoz.guild.adapterCreator but that is canalvoz.guild.voiceAdapterCreator

wispy trout
rough pawn
wintry lily

my bot cant join stage channel and voice channel on discordjs v13

i cant understand new updates

frail peak

Discord v13 not support an audio library?

foggy aspen

You are looking at it.

void wadi
rough pawn I'll use a snippet and explain the code:```js const voice = require('@discordjs/...

Can you help me? I tried following the guide and it won't even join and no error is showing

const { generateDependencyReport, joinVoiceChannel, getVoiceConnection, createAudioPlayer, createAudioResource } = require('@discordjs/voice');
module.exports = {
    name: 'join',
    description: 'Make the bot join voice chat',
    options: [{
        name: 'channel_id',
        type: 3,
        description: 'voice chat id',
        required: true,
    }],
    async execute(interaction, client) {
        try {
            console.log(interaction.options.getString('channel_id'));
            console.log(interaction.guild.id);
            
            let channel = client.channels.cache.get(interaction.options.getString('channel_id'));
            const connection = joinVoiceChannel({
                channelId: channel.id,
                guildId: channel.guild.id,
                adapterCreator: channel.guild.voiceAdapterCreator
            });
            console.log(channel);
            await interaction.reply({content: 'The bot has joined the channel'});

        } catch (error) {
            console.log(error);
        }
    }
};
rough pawn
void wadi

so like I need to make it so it gets it from the message? Not from the channel itself?

rough pawn

you can use join without making an variable and filter the channels before joining to prevent joining to text channels

void wadi
wintry lily

I just want my bot to enter the voice channel and play a link when the bot is running, but I haven't even figured out how to enter the voice in the v13 version, can you help?

void wadi
wintry lily

I've been trying since morning

grizzled sun

can't u use member.voice.channel instead

subtle granite

Hello, does anyone here knows what means AudioPlayerError: aborted?

    at connResetException (node:internal/errors:691:14)
    at TLSSocket.socketCloseListener (node:_http_client:407:19)
    at TLSSocket.emit (node:events:406:35)
    at node:net:672:12
    at TCP.done (node:_tls_wrap:580:7) {
  resource: AudioResource {
    playbackDuration: 65940,
    started: true,
    silenceRemaining: -1,
    edges: [ [Object] ],
    playStream: WebmDemuxer {
      _readableState: [ReadableState],
      _events: [Object: null prototype],
      _eventsCount: 5,
      _maxListeners: undefined,
      _writableState: [WritableState],
      allowHalfOpen: true,
      _remainder: null,
      _length: 1064960,
      _count: 1064758,
      _skipUntil: null,
      _track: [Object],
      _incompleteTrack: {},
      _ebmlFound: true,
      [Symbol(kCapture)]: false,
      [Symbol(kCallback)]: [Function: bound onwrite]
    },
    metadata: {
      name: 'Дайте танк (!) – Бесы',
      url: 'https://www.youtube.com/watch?v=EspTHhWkWEA',
      thumbnail: 'https://i.ytimg.com/vi/EspTHhWkWEA/hqdefault.jpg?sqp=-oaymwEjCOADEI4CSFryq4qpAxUIARUAAAAAGAElAADIQj0AgKJDeAE=&rs=AOn4CLBmvBDk6Jcq3z_59LWAeIWakOjzpQ',
      duration: 141000,
      request: [Object]
    },
    silencePaddingFrames: 5,
    audioPlayer: AudioPlayer {
      _events: [Object: null prototype],
      _eventsCount: 2,
      _maxListeners: undefined,
      subscribers: [Array],
      _state: [Object],
      behaviors: [Object],
      debug: [Function (anonymous)],
      [Symbol(kCapture)]: false
    }
  }
}
```If you ask, I'll enable debugging to get more info. Ping if you'll answer me.
rough pawn

You can't use <voiceChannel>.join() so you need to install additional module @discordjs/voice

wintry lily

How can I simply create a link and put my bot into sound with the link, I couldn't succeed in any way, believe me, I'm about to go crazy :D

subtle granite

Error: FFmpeg/avconv not found!
I have avconv installed, i cant install FFmpeg-static for some reason at all

rough pawn
void wadi

@rough pawn @wintry lily It was a Intent missing 🤣 cryingspin
I just added them all at this point
I am dead on the inside

void wadi
wintry lily
void wadi
wintry lily

Check your bots permission on the channel I think that might be it

minor bison
subtle granite
wintry lily

looks like your bot doesnt have access to create slash commands in that guild

Idk

void wadi

^ it says missing access so either access to the command or the permission on the voice chat

golden path
            const connection = await joinVoiceChannel({voiceChannel});
            const stream = ytdl(args[0], { filter: 'audioonly' });

            connection.play(stream, { seek: 0, volume: 1 }).on('finish', () => {
                connection.destroy({ timeout: 120000 });
            });```
returns this error `TypeError: adapterCreator is not a function` and I'm unsure how to remedy this
subtle granite
rough pawn
subtle granite
--------------------------------------------------
Core Dependencies
- @discordjs/voice: 0.5.6
- prism-media: 1.3.1

Opus Libraries
- @discordjs/opus: not found
- opusscript: not found

Encryption Libraries
- sodium: not found
- libsodium-wrappers: 0.7.9
- tweetnacl: 1.0.3

FFmpeg
- not found
--------------------------------------------------
PS Path/To/Something> npm ls
+-- ffmpeg@0.0.4

Why?

icy maple

The npm package is called ffmpeg-static

subtle granite

The thing is, ffmpeg-static wont install
it hangs and freezes, only ffmpeg will...

icy maple

You can also install the ffmpeg executable from the official site

The ffmpeg you installed is not an option

subtle granite
icy maple

Where are you hosting?

subtle granite

Just on my local pc atm, going to host on a vps

icy maple

I mean where will you be hosting it?

With who?

subtle granite

I mean, its just pterodactyl servers, someones VPS

icy maple

Some hosts have it installed by default

If you can run commands, you can check using ffmpeg

subtle granite
subtle granite
icy maple

Ask ur friend to install it

vocal valley

you can always just install it with like apt-get install ffmpeg

subtle granite

Hm

untold nimbus
golden path
vocal valley

you have to import @discordjs/voice, not discord.js/voice

vocal valley

np

spare snow

@spare wave Hey, sorry for pinging you, but I tried the code you posted earlier today and I removed the asr filter. Surprisingly there's no memory leaks, even without FFMPEG and I have absolutely no idea why, everything looks the same as the music-bot example but the memory usage is way more stable.
If you can give me a hint on anything you changed from the example I'd really appreciate it!

round flint

This seems to happen everytime I disconnect my bot from the voice channel. Any ideas why this could be occuring?

ripe nacelle

I only have a ReadableStream, how can I make a Readable out of it?

fervent estuary

ReadableStream and Readable are the same thing

ripe nacelle

So I can just cast one to another?

fervent estuary

if you mean pipe yes

ripe nacelle

nah, i meant cast my ReadAbleStream to a Readable, you certainly cannot pipe from one readable to another

fervent estuary

where exactly are you getting the "ReadableStream"

ripe nacelle

from an older library

naudiodon

I'll see if it works

fervent estuary

and which one do u need to cast that into?

wintry lily

@void wadiwas able to run the voice join command

golden path

I set up the new voice channel stuff at the top of my code to define joinVoiceChannel.

async execute(message, args) {
        voice.joinVoiceChannel({ 
            guildId: message.guild.id, 
            channelId: message.member.voice.channelId, 
            adapterCreator: message.guild.voiceAdapterCreator
        });

I can get the bot to join the vc but I get this error:

2021-08-09T20:43:42.613424+00:00 app[Worker.1]:             const connection = await joinVoiceChannel({voiceChannel});
2021-08-09T20:43:42.613425+00:00 app[Worker.1]:                                ^
ripe nacelle

I have a raw audio stream and I want to let my bot play that stream. But it instantly crashes with the error Premature close. Could be that the Audio Player completed the stream for now and just shut off?

obtuse cradle

There is a way to make sure that the bot connects as an stage speaker instead of an stage audience?

devout sequoia

how to check if the bot is in voice channel?

north scaffold

hey has the audio receive function pr been approved ? :D

bright moth

i have @discordjs/opus(0.5.3), ffmpeg-static(4.4.0), libsodium-wrappers(0.7.9)

fallow locust

I've heard I need to update my code. Can someone tell me what needs to change with this?

        channel.join().then(connection => {
            console.log("Successfully connected");
            }).catch(e => {
              console.error(e);
         });
zenith tiger

is there a function that skips the current playing song?

rose helm

stop the current player

carmine timber
zenith tiger

Already got it thanks anyway

glacial turret

What's going on ytdl-core that causes it to abort randomly? I realize this isn't strictly DJS voice-related but it's pretty parallel to it.

carmine timber
glacial turret

Ty ty. Dunno why I didn't check there.

carmine timber
glacial turret Ty ty. Dunno why I didn't check there.

Simple Fix for that :
Confirmed, setting ytdl-core highWatermark option to 32MiB on Node.js v16 (16.5.0) fixes the problem, so the workarounds are use Node v14.x or play with the highWatermark settings, not sure if this will apply to everyone.

carmine timber
carmine timber
carmine timber
devout sequoia
devout sequoia
carmine timber
devout sequoia

This is native to node.js?

^

carmine timber

@vocal valley Review my pr as VoiceRecieve is almost done.

grizzled wadi

Hey, just switched to v13, and I don't fully understand how voice works, my connection is stuck signalling. I'm trying to have the bot join the VC and then play a sound.

Code:

const Discord = require("discord.js");
const voice = require("@discordjs/voice");

console.log(voice.generateDependencyReport());

var audioPlayer = voice.createAudioPlayer({
  behaviors: {
    noSubscriber: voice.NoSubscriberBehavior.Play,
  },
});

const confirm = voice.createAudioResource("../assets/sounds/confirm.mp3");

/** @type {voice.VoiceConnection} */
var connection;

/**
 *
 * @param {Discord} Discord
 * @param {Discord.Client} Client
 * @param {Discord.ButtonInteraction} interaction
 */
async function joinVC(Discord, Client, interaction) {

  if (interaction.member.voice.channel) {
    connection = voice.joinVoiceChannel({
      channelId: interaction.member.voice.channelId,
      guildId: interaction.guild.id,
      adapterCreator: interaction.guild.voiceAdapterCreator,
    });

    connection.on(voice.VoiceConnectionStatus.Ready, async () => {
      audioPlayer.play(confirm);

      connection.subscribe(audioPlayer);
      await interaction.editReply("Done!");
      await interaction.deleteReply();
    });
  } else
    return interaction.editReply(
      "Sorry, you can't do that! \n`Error Code: 2 | NO_VC`"
    );
}

This is in a small module that gets required into the main index.js file.

Thanks for any help!

carmine timber
grizzled wadi
//Line 5
const Discord = require("discord.js");
const Client = new Discord.Client({
  intents: [Discord.Intents.FLAGS.GUILDS, Discord.Intents.FLAGS.GUILD_MESSAGES],
});

I need a voice intent?

carmine timber
grizzled wadi

That helps a ton, thanks

carmine timber

NP 👍

grizzled wadi

So, once the connection is ready, do I subscribe first, or play first?

  connection.on(voice.VoiceConnectionStatus.Ready, async () => {
    
      audioPlayer.play(confirm);
      connection.subscribe(audioPlayer);

      await interaction.editReply("Done!");
      await wait(5000)
      await interaction.deleteReply();
    });
carmine timber
grizzled wadi

Hmm, I'm not hearing anything either way

carmine timber
grizzled wadi
const confirm = voice.createAudioResource("../assets/sounds/confirm.mp3");

Core Dependencies

  • @discordjs/voice: 0.5.6
  • prism-media: 1.3.1

Opus Libraries

  • @discordjs/opus: 0.5.3
  • opusscript: not found

Encryption Libraries

  • sodium: not found
  • libsodium-wrappers: 0.7.9
  • tweetnacl: not found

FFmpeg


carmine timber
grizzled wadi

aah, I'll go with path.join then

grizzled wadi

Appriciate

subtle granite

can someone help me with this? I'm having a lot of trouble with this code:

const { Client, Intents } = require('discord.js');
const client = new Client({ intents: 32767 })
const Command = require("./src/Structures/Command.js");

var Discord = require('discord.js');
var isReady = true;

if (command === "!call") {
    var VC = message.member.voiceChannel;
    if (!VC)
        return message.reply("MESSAGE IF NOT IN A VOICE CHANNEL")
VC.join()
    .then(connection => {
        const dispatcher = connection.playFile('C:/Users/Claudiu/Desktop/Customer Service/open.mp3');
        dispatcher.on("end", end => {VC.leave()});
    })
    .catch(console.error);
};```

the error is:

throw err;
^

Error: Cannot find module './src/Structures/Command.js'
Require stack:

  • C:\Users-\UrGud's Bot\src\Commands\call-functionality.js
  • C:\Users-\UrGud's Bot\src\Structures\Client.js
  • C:\Users-\UrGud's Bot\index.js
    at Function.Module._resolveFilename (node:internal/modules/cjs/loader:933:15)
    at Function.Module._load (node:internal/modules/cjs/loader:778:27)
    at Module.require (node:internal/modules/cjs/loader:1005:19)
    at require (node:internal/modules/cjs/helpers:94:18)
    at Object.<anonymous> (C:\Users\Claudiu\UrGud's Bot\src\Commands\call-functionality.js:3:17)
    at Module._compile (node:internal/modules/cjs/loader:1101:14)
    at Object.Module._extensions..js (node:internal/modules/cjs/loader:1153:10)
    at Module.load (node:internal/modules/cjs/loader:981:32)
    at Function.Module._load (node:internal/modules/cjs/loader:822:12)
    at Module.require (node:internal/modules/cjs/loader:1005:19) {
grizzled wadi

It can't find your module

carmine timber
late osprey

./src/Structures/Command.js doesn't exist

subtle granite
late osprey

You're requiring it from a different folder

grizzled wadi

Where is the file that you posted?

carmine timber
subtle granite
carmine timber
subtle granite

yeah

late osprey

You aren't requiring it from the main file though

subtle granite
carmine timber
subtle granite yeah

Then you can try this :

const path = require('path')

let actual_path = path.resolve('./src/Structures/Command.js')
const Command = require(actual_path)
grizzled wadi
late osprey

You are requiring it from call-functionality.js tho

carmine timber
subtle granite
late osprey

It's in a different folder?

carmine timber
grizzled wadi
subtle granite ..so what does that mean?
const Discord = require("discord.js");
const voice = require("@discordjs/voice");
const path = require("path")
const wait = require("util").promisify(setTimeout);

console.log(voice.generateDependencyReport());

var audioPlayer = voice.createAudioPlayer({
  behaviors: {
    noSubscriber: voice.NoSubscriberBehavior.Play,
  },
});
const filePath = path.resolve("../assets/sounds/confirm.mp3")
const confirm = voice.createAudioResource(filePath);

/** @type {voice.VoiceConnection} */
var connection;

/**
 *
 * @param {Discord} Discord
 * @param {Discord.Client} Client
 * @param {Discord.ButtonInteraction} interaction
 */
async function joinVC(Discord, Client, interaction) {

  if (interaction.member.voice.channel) {
    connection = voice.joinVoiceChannel({
      channelId: interaction.member.voice.channelId,
      guildId: interaction.guild.id,
      adapterCreator: interaction.guild.voiceAdapterCreator,
    });

    connection.on(voice.VoiceConnectionStatus.Ready, async () => {
      audioPlayer.play(confirm);

      connection.subscribe(audioPlayer);
      await interaction.editReply("Done!");
      await wait(5000)
      await interaction.deleteReply();
    });
  } else
    return interaction.editReply(
      "Sorry, you can't do that! \n`Error Code: 2 | NO_VC`"
    );
}
exports.joinVC = joinVC;
exports.connection = connection;

wrong reply, sorry

subtle granite

bruh

late osprey
late osprey
subtle granite

yeah

late osprey

Then ../Structures/Command.js

subtle granite
velvet rock
 const resource = createAudioResource(`./records/Paris.mp3`);
                const player = createAudioPlayer();
                connection.subscribe(player);
                player.play(resource);

i get no errors but doesnt work ..........

vocal valley

Planning on releasing 0.6.0 of the library today which features voice receive!

@carmine timber your PR will make it into 0.6.1, i need to write tests still and address some comments on the PR

carmine timber
inner wren

hello, please help me
The code :


module.exports = {
    name: 'play',
    aliases: ['p'],
    category: 'Music',
    utilisation: '{prefix}play [name/lien]',

    run: async (client, message, args, cmduser, text, prefix)=> {
        if (!message.member.voice.channel) {
        
          const embed1 = new MessageEmbed()
        .setDescription(`![non](https://cdn.discordapp.com/emojis/873277850520813618.webp?size=128 "non") ${client.emotes.error} - Tu n'est pas dans un salon vocal. !`)
        .setColor('#9b9b9b')
        return message.channel.send({ embeds: [embed1] }) }
        if (message.guild.me.voice.channel && message.member.voice.channel.id !== message.guild.me.voice.channel.id)  {
        
          const embed2 = new MessageEmbed()
        .setDescription(`![non](https://cdn.discordapp.com/emojis/873277850520813618.webp?size=128 "non") ${client.emotes.error} - Je suis deja dans un salon vocal`)
        .setColor('#9b9b9b')
        return message.channel.send({ embeds: [embed2] }) }
        if (!args[0])  {
        
          const embed3 = new MessageEmbed()
        .setDescription(`![non](https://cdn.discordapp.com/emojis/873277850520813618.webp?size=128 "non") ${client.emotes.error} - Merci d'indiquer le son`)
        .setColor('#9b9b9b')
        return message.channel.send({ embeds: [embed3] }) }
        client.player.play(message, args.join(" "), { firstResult: true });
    },
};

The error :

carmine timber

@vocal valley I have added 2 tests for FFMPEG.

bright moth

@carmine timber i guess u didn't quite get that i have @discordjs/opus installed (i literally listed the dependencies)

carmine timber
carmine timber
bright moth

2 min

carmine timber

And also tell the exact path of your bot's index/main file.

bright moth

dist/index.js

carmine timber

Can you make a new folder and then type npm init -y and then install packages again (like discord.js, @discordjs/voice, opus, libsodium-wrappers etc) ??

Your problem will be solved 😄

bright moth

wtf create a folder where and for what?

dist is just the compiled code

carmine timber
bright moth
carmine timber
bright moth

Ok, so in this folder do

npm init -y
npm install <all packages again as mentioned above>
bright moth

and is there a way i can fix this for the main dir?

carmine timber
bright moth

the audio played but interaction still failed which i will fix

bright moth

installing all those dependencies fixes it

but the audio is so fucking choppy

carmine timber
bright moth <@!828872488817393717>

Yes there is a way,

Type this :

npm uninstall @discordjs/opus -g

And then make sure there is no folder in ``C:\Users\David\OneDrive\Documents\Shavel\node_modules@discordjs\opus\prebuild`

After that, just do :

npm install @discordjs/opus -g
carmine timber
red nest

My audioPlayer just emit stateChange twice
And both state are same, is that normal?

bright moth
red nest
bright moth

the Track class

red nest
carmine timber
bright moth

it's nearly the same from the example bot with some modification

carmine timber
red nest
pulsar plinth

how can i force move a user to a channel when he presses a button??

bright moth
bright moth

Mbps

carmine timber
red nest

o wait I saw it

carmine timber
grizzled wadi

I know it's bad practice, but I download what I'm going to be playing to a file, then stream from that

carmine timber
grizzled wadi
red nest
red nest
grizzled wadi

I don't use them, although I don't have a filter for them

carmine timber

Nice 😄

grizzled wadi

nobody has requested them lmao

carmine timber

LMAO

grizzled wadi

I wonder what would happen

red nest

Lifecycle:
add song using method add(), then use method start()

@carmine timber Here is song data when using method add()

[
  {
    "url": "Youtube url",
    "title": "Video title",
    "duration": "Video duration",
    "thumbnail": "Video thumbnail",
    "type": "song",
    "by": "Who queued this song"
  }
]
grizzled wadi

I got more issues with more audio, the only difference here is that I'm making the resource right before I play it

async function playVideo(info, interaction) {
  if (!connection) {
      console.log(connection)
    return interaction.editReply(
        "Sorry, you can't do that! \n`Error Code: 2 | NO_VC`"
      );
  } else {
    const videoPath = path.resolve("./download/video.mp3")
      const video = voice.createAudioResource(videoPath)
      audioPlayer.play(video)
      interaction.deleteReply()
  }
}
red nest

without reslove it

carmine timber
grizzled wadi

I plan to use it on another PC than the one I'm writing it on

and this is just easier to understand in the moment

carmine timber
carmine timber
red nest

O wait error appeared, let me prepare debugger

grizzled wadi

eyes_sus

carmine timber

👀

grizzled wadi

Yeah, that's not there

carmine timber
grizzled wadi

uhh... I'm not sure

carmine timber
grizzled wadi

Yeah, earlier up, in another function

when it joined the vc

carmine timber
grizzled wadi

I added it, still not playing audio

red nest
grizzled wadi
async function playVideo(info, interaction) {
  if (!connection) {
      console.log(connection)
    return interaction.editReply(
        "Sorry, you can't do that! \n`Error Code: 2 | NO_VC`"
      );
  } else {
    const videoPath = path.resolve("./download/video.mp3")

    const video = voice.createAudioResource(videoPath)
       sub = connection.subscribe(audioPlayer)
      audioPlayer.play(video)
      interaction.deleteReply()
  }
}
carmine timber
grizzled wadi

I figured it would already be ready, as I made it earlier, in the join function, and I've been using the same variable, connection is declared at top level

red nest

@carmine timber
When it is bugged, every guild cannot play any song
State change: buffering => playing
But no any sound playing, only restart can break this error, but it will bugged again

Recreate conenction, audioPlayer, audioResource doesnt work

AudioResource#playbackDuration always 0

carmine timber
red nest
carmine timber
grizzled wadi

and the connection is ready, just checked

carmine timber
red nest 266 now

266 and using class is not a way to go

Since then you will be creating 266 objects classes into memory and that will lead to memory leaks. So I guess when that bugs occur, you have memory leaks issues.

So I think you should monitor your memory and see if there is memory leak or not.

That's only possible error that I can think of

carmine timber
red nest

And about memory leak, my bot use 150~160 MB ram

carmine timber
red nest

You can just ignore chinese string...
No error, nothing in console

grizzled wadi

should have sent that in a message.txt

red nest
dusty needleBOT

To share long code snippets use a service like gist, sourcebin , starbin, or similar instead of posting them as large code blocks.

grizzled wadi

true, but I'm kinda lazy

subtle granite

@carmine timber can i dm you

grizzled wadi

aah

poor dude, so busy, got 3 people on him

carmine timber

XD

placid canyon

Hey, does anybody know how to fix the problem with discordjs / ytdl-core when trying to play an youtube stream? When Im playing live videos with ytdl and discordjs's new voice the bot joins perfectly, plays for 2 seconds (the amout of time It bufferd) or so and then instantly leaves. (normal youtube videos work perfectly fine)

red nest
brittle veldt

Rule 1

humble gate

help plz

brittle veldt

Error seems pretty self-explanatory. the channel is full

humble gate
brittle veldt

check voicechannel.full before joining

humble gate

It's not full but the bot can't enter it
I want a solution, instead of the robot crashing, it says I can't get room voice

sharp gull

i this way exists to seek to duration on audioResource

im using local audio files