#archive-voice

30636 messages · Page 13 of 31

carmine timber

No, I changed connection to checkConnection.destroy()

torn shoal

lemme try!

wise kraken

hey guys, is there some way in v13 to get the audioplayer equivalent of streamTime?

carmine timber
wise kraken

amazing thank you

torn shoal
carmine timber yes

pushed the change, btw how can we track when a particular user joins and leaves a voice channel?

dusty needleBOT

Documentation suggestion for @torn shoal:
_ (event) Client#voiceStateUpdate
Emitted whenever a member changes voice state - e.g. joins/leaves a channel, mutes/unmutes.

torn shoal

got the same error again btw

@carmine timber

carmine timber
           
            player.on(AudioPlayerStatus.Idle, () => {
                setTimeout(() => {
                let checkConnection = getVoiceConnection(message.guild.id);
                    if(checkConnection){
                        checkConnection.destroy()}
                    else return;
                }, 300000);;
            })

@torn shoal Try this one

torn shoal

k

carmine timber

@vocal valley
One question

when the audioPlayer is in autopaused condition if we run audioPlayer.stop(), then player will go in Idle and destroy resource OR player will remain in autopaused ??

vocal valley

It should go in Idle and destroy the resource

calling .stop() on audio player should always go to Idle and destroy whatever resource is active

torn shoal

didn't get the error for now

storm nova

but what would audio player be equalled to guys I dont understand help please ddddddd

carmine timber
vocal valley

If you do .stop(true), it will always go to idle

vocal valley
vocal valley
storm nova
vocal valley
storm nova

yes

vocal valley

Look at the audio player page in the guide

carmine timber
vocal valley

It will work eventually but not immediately

storm nova
vocal valley

By default it plays 100ms of silence before ending

carmine timber

Ok let me run few more tests, Then will talk

vocal valley

Ok

It may also be 200ms cannot remember

No sorry it is stop(true) was right the first time lol

carmine timber

lol

storm nova

but would this line just play the specified track in the specified location?

vocal valley

nope, that just loads the track basically

storm nova

ah

vocal valley

player.play(resource) plays the track on a player, and connection.subscribe(player) means the player will play to that voice connection

storm nova

thanks man

wait what would connection1 and connection2 be equal too would i just use the same one from my join.js command?

vocal valley

connection1 and connection2 are just connections you get from joinVoiceChannel

carmine timber
vocal valley

To prevent that from happening, when you create resources, by default they include 5 frames of silence at the end, so the opus decoder in the client doesn't mix up audio from one track to the next, since this sounds glitchy

carmine timber

Okay

vocal valley

.stop() and .stop(false) are equivalent, it means to play the 5 frames of silence before stopping

.stop(true) means to force stop, and not play any silence

carmine timber

Okay I understand now, thanks

vocal valley

Np

storm nova
carmine timber
storm nova

yeah i realized that right after posting

its not playing never gonna give you up :(

carmine timber
storm nova

how do i do it with yt urls?

carmine timber
lament quartz

how do I get a vc in a guild by name

tight lodge

Can someone let me know how to check if a voice channel is empty ?
I want my bot to leave on a timeout after the voice channel is empty, however I did not find a class that can check for that or I am blind

subtle condor

s it ok for a bot to join stage channel

const stageChannel = message.member.stage.channel;
            stageChannel.join()```
dusty needleBOT

Guide suggestion for @subtle condor:
_ discordjs.guide results:
• Library: Cheat sheet - Creation

vocal valley
tight lodge

ah okay, but how do I access voiceChannels property ?

I would appreciate it if you can send the docs where exactly I should look

vocal valley

the voice library doesn't track people in voice channels, but discord.js does

tight lodge

Thank you, I will take a look

oak folio

hi why does my discord bot voice connection stay in "signalling" status

carmine timber
verbal moth

would they fix the aborted error ?

carmine timber
verbal moth

play dl is like ytdl ?

carmine timber
verbal moth

hmm okay ill try

is there a doc for it ?

carmine timber
verbal moth

ty

river hornet

upgrade quality audio from local file?

sacred cove

how do you set self-deaf in a guild? In v12 there was the guild voice property but it's not a thing anymore

tawdry halo

Do you mean something like that?

sacred cove

oh there it is, perfect

tawdry halo

I think you can log the connection object in order to see further information about such things

sacred cove

well it's enough to have self deaf for the connection, I won't need to turn it on and off on-the-fly

summer crow
(Use node --trace-warnings ... to show where the warning was created)```

what is this?
verbal moth

maybe u have too much subscribers

is there a way to upgrade music quality with play-dl ?

terse smelt

So what's the new on.finish? When a song finished it just went silent and didn't go to the next song, I'm assuming I need to change that out of my code

oh nvm think I found it, gotta use player.on idle

lime bough

guys how do you make so your music bot leaves after like 5 minutes when no one is in the voice channel?

shut nexus

I just switched to DiscordJS v13 and I'm having trouble getting the voice stuff up and running. This is my code (with some extraneous stuff removed for clarity):

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

    try {
      await entersState(connection, VoiceConnectionStatus.Ready, 30000);
      message.channel.send("Joined voice channel.");
    } catch (e) {
      message.channel.send("Failed to join voice channel.");
      console.log(e);
    }

Now even though I can see the bot join the voice channel, that try catch always fails, and this is the error that gets logged: AbortError: The operation was aborted

I must be doing something obviously wrong but I can't see what for the life of me

carmine timber
twilit quarry

Tried to bodge together a livestream player from the docs. When I connect to the channel I subscribed to player, it says it is playing, even when I console.log player, but no sound is played.```js
const { Client, Intents } = require('discord.js'),
{joinVoiceChannel,getVoiceConnection,VoiceConnectionStatus,entersState, createAudioPlayer,NoSubscriberBehavior,createAudioResource} = require('@discordjs/voice'),
ytdl = require('ytdl-core'),
client = new Client({intents:[Intents.FLAGS.GUILDS]});
let player = {};

client.once('ready', () => {
player = createAudioPlayer({behaviors:{noSubscriber:NoSubscriberBehavior.Play}});
const resource = createAudioResource(ytdl(LIVESTREAM_URL, {quality:"highestaudio",format:"audioonly"}));
player.play(resource);
console.log("Ready!");
});```

carmine timber
carmine timber
twilit quarry
shut nexus
carmine timber
terse smelt

Anyone have/seen issues with songs skipping/cutting out in during the song? I'm using youtube-dl-exec for reference, not ytdl

jaunty trail

is there any kind of player event when the player stops playing audio due to the audio file being finished?

zenith raven

I have doubt so when I convert a live stream into mp3, ogg or any format using ffmpeg it goes on encoding and the file memory goes up. Is their an approach to do live encoding rather than saving it in local memory. So like taking the m3u8 file encoding it to mp3 and directly playing in a voice without saving ? I am pretty new to djs so yeah!

shut nexus
carmine timber
zenith raven
carmine timber

Oh, then go for ffmpeg no other options

If you directly create resource with url in createAudioResource, voice will use ffmpeg eventually.

terse smelt

So I think I narrowed my issue down to being websocket connections closing, is there a way to keep the websockets up when playing music?

zenith raven
sacred cove

why do voice connection events emit multiple times at once?

subtle granite

Why it's eating a very lot of memory lol ?

I'm just at 10GB...

subtle granite
carmine timber
carmine timber
subtle granite
carmine timber

So what is it ??

subtle granite

My bot work well, I just have a fucking lot of memory usage.
10 hours uptime, 11GB usage memory..

carmine timber
sharp ice
--> npm install @discord.js/voice
npm ERR! code E404
npm ERR! 404 Not Found - GET https://registry.npmjs.org/@discord.js%2fvoice - Not found
npm ERR! 404 
npm ERR! 404  '@discord.js/voice@latest' is not in the npm registry.
npm ERR! 404 You should bug the author to publish it (or use the name yourself!)
npm ERR! 404 
npm ERR! 404 Note that you can also install from a
npm ERR! 404 tarball, folder, http url, or git url.

npm ERR! A complete log of this run can be found in:
npm ERR!     /home/runner/.npm/_logs/2021-08-31T15_22_07_988Z-debug.log
exit status 1

Crying what is the problem

ripe orchid

@discordjs/voice

sharp ice
storm nova
twilit quarry

Anyone know why a ytdl livestream bot would die with AudioPlayerError: Aborted?

subtle granite
dull relic

having issues with streaming audio to Discord
everything i do it won't switch from signaling to ready after it joined a voice channel
and also it doesn't appear to recognize when i join or move voice channels (it still thinks im in whatever voice channel it saw me in, if any, when it started)

these are the deps

subtle granite

I have the intents defined for voice, and the bot joins correctly, now my issue is actually playing an online stream through the bot... am i forgetting something..?
think_bold

icy maple

<connection>.subscribe(<player>)

subtle granite

Ah, thank you, it works now.

weary spade

How do I check if the bot is a speaker in a stage channel?

twilit quarry
carmine timber You forgot to add `GUILD_VOICE_STATES` intent

Seems I broke something. Same problem, I have connected to a channel, and the halo is green, but there is no audio coming out. It's weird, because it was working before, but I was using ytdl-core, now I switched to youtube-dl-exec, so that it didn't error out. I have verified that I have GUILD_VOICE_STATES this time.

spare wave

For youtube-dl-exec, you need to install python 2 on the system as well. Not python 3

twilit quarry
spare wave

I'm assuming all the other dependacy like opus etc stated on the guide is installed. So nothing else,

twilit quarry
twilit quarry
spare wave

If there something else missing, not really sure

twilit quarry
spare wave

Yes

subtle granite

hi niridyHey
can someone explain me how to use cookies for ytdl-core ? (for accessing to age restricted content)
because following the github support feed, it seems not working at all 👀

empty torrent
glass stirrup
        player.on(AudioPlayerStatus.Idle, async ()  => {
            interaction.channel.send(`I have nothing to play, Bye!`)
            setTimeout(() => player.stop(),
            connection.disconnect(), 10000)
        }) 

Anyone have ideas on why this is triggering although the song is not finished? It doesn't end the song or disconnect, just sends the interaction message. Am I over thinking this or is it just because of an interactions life cycle where it want's to be completed within 15 mins

carmine timber
glass stirrup

^^ I took that advice. 10/10 better

carmine timber
glass stirrup

it's a pretty short code, I can post it if you'd like. wouldn't mind a second set of eyes to be honest

ebon veldt

can someone send me a guide to djs voice

ebon veldt
winter cedar

hi! i used the join voice channel code from the discord.js guide but it keeps crashing when i do the command. is there anything to fix this/change something?

client.on('interactionCreate', async (interaction) => {
    if(interaction.commandName === 'test'){
        await interaction.reply({content: 'test', ephemeral: true})
    }
    if(interaction.commandName === 'play'){
        await interaction.reply({content: 'joining voice...', ephemeral: true})
        const connection = joinVoiceChannel({
            channelId: channel.id,
            guildId: channel.guild.id,
            adapterCreator: channel.guild.voiceAdapterCreator,
        });
    }
})```
terse smelt

Trying to get my bot to play music in the stage channel. It joins and starts the stage, but joins only as a listener. How do I get my bot to be a speaker?

dusty needleBOT

Documentation suggestion for @terse smelt from @carmine timber:
_ VoiceState#setSuppressed()
Suppress/unsuppress the user. Only applicable for stage channels.

winter cedar

how do i do that?

carmine timber
winter cedar

ok thanks! ill try

terse smelt

Thanks NIP, it seems now it's stating that I'm only allowed to do this in a stage channel (which it is), any thoughts?

carmine timber
dusty needleBOT

Documentation suggestion for @terse smelt:
_ StageChannel#type
The type of the channel

terse smelt

Gotcha, will make a check

open tulip

this is my code that when the bot Goes online join to a Voice channel but the bot dosent join can u help !

client.on('ready', () => {
  console.log(`${client.user.tag} Online Shod`);
  setInterval(() => {
      const channel = client.channels.cache.get("858618703474458654");
      if (!channel) return console.error("Channeli Vojod Nadarad");
      channel.join().then(connection => {
          console.log("Bot Be Channel Join Shod");
          //connection.voice.setSelfDeaf(true)
      }).catch(e => {

          console.error(e);
      })
  }, 5000);
});

this is the error what should i write insted of channel.join

TypeError: channel.join is not a function
    at Timeout._onTimeout (E:\2.iTz Club\bot.js:54:15)
    at listOnTimeout (node:internal/timers:557:17)
    at processTimers (node:internal/timers:500:7)
distant osprey

you were told to read pins

open tulip
distant osprey
open tulip

ok tnx

open tulip
distant osprey

you don't read our messages, do you?

sacred cove

how do you check if the player is paused? In v12 there was the dispatcher.paused property

sacred cove

oh I see

subtle granite

I use the radio bot example for testing. Sometimes the bot disconnects unexpectedly without any warning or error. When I use the join command, it says that it is already in this channel, but it is not connected. How do I fix this? Or how can I make the bot reconnect on unexpected disconnects?

subtle granite

I think it might have todo with maxMissedFrames

terse smelt
 if(stageChannel.type === 'GUILD_STAGE_VOICE'){
        try {
            await stageChannel.createStageInstance({ topic: 'Listen.moe Radio' });
            await guild.me.voice.setSuppressed(false);
          } catch (error) {
            console.error(error);
          };
        } else {
            console.log(`Problem with the stage channel.`)
        }

I console.logged the channel.type and it's indeed guild_stage_voice, however it still states that the channel isn't(?)

carmine timber
terse smelt

Just realized I was missing an AWAIT, so the channeltype issue is resolved. However now it's stating that the stage channel is already open (if bot is restarted while stage is open) on the createStage function.
is there a way to check if stage is open and skip that line if so?

It doesn't crash my bot so I'm assuming I can just ignore this error

dusty needleBOT
subtle granite

@valid marsh how can i make my bot join stage?

valid marsh

See the guide in pins

summer crow
terse smelt
subtle granite
hexed stone

I just wanna say that the @discordjs/voice guide is completely and utterly useless and unfriendly compared to the main discordjs guide. Thats all I have to say, thanks for coming to my TED talk, I am now leaving the server.

terse smelt

Didn't realize I was at an airport where people need to announce their departure 😂

On a side note, I'm still having troubles locating where I can check for if a stage is open or not as per this error.
stageInstance in the docs doesn't have any notation anywhere about this from what I've been able to see

subtle granite

@terse smelt Why don't you just check if the topic of the stage is set?

wild zephyr

If there's an instance, doesn't that mean there is one?

wild zephyr
subtle granite

And I think topic can not be null according to the docs

terse smelt

This is true. I could try that

wild zephyr

Yeah try the topic of the instance, rather than the channel

terse smelt

But even if bot is not there/restarts, the channel topic is still set

verbal moth

TypeError: Cannot read property 'stream' of undefined

const audio = await pdl.stream(video).catch(err => clean())
const ressource = createAudioResource(audio.stream, { inputType: audio.type}).catch(err => clean())```
An idea ?
terse smelt

wait nvm overthought it a sec

verbal moth

yes but why ?

subtle granite

What are you trying to do?

verbal moth

i catched the error but the bot still crash...

wild zephyr

Well pdl can be undefined too there, we don't know much

verbal moth
subtle granite
verbal moth

pdl is play-dl module

ok i'll try

subtle granite
terse smelt
timber crystal

i've been following the music example from the guide's FAQ and yet.. nothing plays. the bot will join my channel, send a message, and then never play anything. no console output either. i've tried doing a dependency check, it was all good (i can send the results here if needed), i've tried a million things, nothing seems to work. i even thought it might be a ytdl issue so i even tried playing a local file (following the example on the voice section of the guide), that doesn't work either. i'm super lost, any help would be greatly appreciated. here's my code right now:

const {
  createAudioPlayer,
  createAudioResource,
  joinVoiceChannel,
  AudioPlayerStatus,
} = require('@discordjs/voice')
const { SlashCommandBuilder } = require('@discordjs/builders')
const { join } = require('path')

module.exports = {
  data: new SlashCommandBuilder().setName('p').setDescription('test'),
  async execute(interaction) {
    await interaction.deferReply()

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

    const resource = createAudioResource(join(__dirname, 'file.mp3'))
    const player = createAudioPlayer()

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

    await interaction.followUp('Now playing!')

    player.on(AudioPlayerStatus.Idle, () => connection.destroy())
  },
}
terse smelt

Did you npm install libsodium-wrappers?

timber crystal

yeah, i installed both that and sodium

i'm using yarn, though i can't imagine that would affect it

--------------------------------------------------
Core Dependencies
- @discordjs/voice: 0.6.0
- prism-media: 1.3.2

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

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

FFmpeg
- version: 4.4-tessus  https://evermeet.cx/ffmpeg/ 
- libopus: yes
--------------------------------------------------

dependency report

terse smelt

@timber crystal here's what mine looks like, it works flawlessly for me, maybe you'll see something in here that stands out/can help

Might need the enterState to get it playing

timber crystal

added it, still not working :(

subtle granite

@timber crystal Do you have the intent for voice defined

VOICE_STATE_UPDATES

timber crystal

you're a genius, thank you so much

did i miss that or is it not in the guide?

subtle granite

I don't know if its in the guide but its required

Otherwise the bot does not know whether it has connected

solid trench

is it possible to create a seperate node process which just deals with playing audio?

lilac stream
Require stack:
- /root/node_modules/@discordjs/opus/lib/index.js
- /root/funradio/index.js```
lilac stream

this is radio bot

subtle granite

Did you install @discordjs/opus?

lilac stream

hes

subtle granite

And the other required dependencies?

lilac stream

I have installed all the modules

Moment , @discordjs/opus, opusscript , opus

prims-media

subtle granite

@discordjs/voice, ffmpeg and sodium?

lilac stream
subtle granite

I can't see what the problem is from your error

Can you show the code that you are trying to run?

lilac stream

you want to have access to my vps?

subtle granite

No...

I only want to see what you are trying to do with your bot

lilac stream

I show which line? because it is long

subtle granite

funradio/index.js

lilac stream

ok, but I can't install the sodium module

subtle granite

Thats the problem

You either need sodium or libsodium-wrappers

lilac stream
subtle granite

Install libsodium-wrappers instead

npm remove sodium && npm i libsodium-wrappers

lilac stream
subtle granite

You already have it installed

Then thats not the problem

lilac stream

oof , what should i do then?

?

round peak

What am i missing? im trying to play a mp3 file which comes from a playlist array. it goes through everything without an error but never joins the channel and doesn't play anything then

        channelId: interaction.channelId,
        guildId: interaction.guildId,
        adapterCreator: interaction.guild.voiceAdapterCreator,
    });
    isPlaying = true;

    const player = createAudioPlayer();

    const resource = createAudioResource('sounds/' + playlist.shift().file + '.mp3');
    player.play(resource);
    try {
        entersState(player, AudioPlayerStatus.Playing, 5_000);
    }catch(error){
        console.log(error);
    }
    connection.subscribe(player);```
icy maple
round peak

oo, haha, shoot. for some reason i thought that was my channel... i need to find user.channelid

icy maple

<Member>.voice.channelId

Or otherwise get <VoiceChannel>.id

round peak
icy maple

Yea

round peak

it joins the channel but i don't hear anything yet

digital sphinx

Music Bot suddenly crashes after 5 to 20 minutes

urban iron

how to make a 24/7 music bot

round peak

@icy maple ``` await joinVoiceChannel({
channelId: interaction.member.voice.channel.id,
guildId: interaction.guildId,
adapterCreator: interaction.guild.voiceAdapterCreator,
});
isPlaying = true;
const connection = getVoiceConnection(interaction.guildId);
const player = createAudioPlayer();
const audioFile = playlist.shift() + '.mp3';
console.log(audioFile);
const resource = createAudioResource(audioFile, {
inlineVolume: true,
metadata:{
title: 'WTF',
}
});
async function start(){
player.play(resource);
try {
await entersState(player, AudioPlayerStatus.Playing, 5_000);
console.log('playback started');
}catch(error){
console.log(error);
}

}
void start();
connection.subscribe(player);
player.on(AudioPlayerStatus.Idle, () => connection.destroy());``` it joins but never plays
weary spade

How do I detect if my bot has been disconnected from a VC?

client.on("voiceStateUpdate", async (oldState, newState) => {
                console.log('no it is working')
                console.log(oldState.channel)
                console.log(newState.channel)
                if (!newState.channel && oldState.channel) {
                    console.log("1")
                    if (oldState.id === client.user.id) {
                        console.log("2")
                        player.destroy()
                    }
                }
            })```
doesn't print 1 or 2
ebon veldt
const { SlashCommandBuilder } = require('@discordjs/builders');
const { joinVoiceChannel } = require('@discordjs/voice');


module.exports = {
    data: new SlashCommandBuilder()
        .setName('play')
        .setDescription('Play your favorite music!'),
    async execute(interaction) {
    await joinVoiceChannel({
        channelId: interaction.member.voice.channel.id,
        guildId: interaction.guildId,
        adapterCreator: interaction.guild.voiceAdapterCreator,
    });
    const { createReadStream } = require('fs');
    const { createAudioResource, createAudioPlayer, StreamType } = require('@discordjs/voice');
    const { join } = require('path');
    
    const player = createAudioPlayer();

    resource = createAudioResource(createReadStream(join(__dirname, '/music/track.ogg'), {
        inputType: StreamType.OggOpus,
    }));

    player.play(resource);
    await interaction.reply('Joined!');

    },
};


``` Doesnt play the music, joins the channel though
quasi tundra

joinVoiceChannel returns something, which you have to subscribe to the audio player

const connection = await joinVoiceChannel; connection.subscribe(player); // once player is defined
@ebon veldt

Okay, is there any way to run code once an AudioResource is done playing, it doesn't seem to be an event emitter?

Ah just remembered, get an AudioPlayer and attach the code there

twilit quarry

Is there any way to fetch all of the currently connected voice channels, if I don't already have them stored somewhere?

round peak

anyone help me with what i am doing wrong? i can't get my sound files to play. it joins but doesnt play anything.

        channelId: interaction.member.voice.channel.id,
        guildId: interaction.guildId,
        adapterCreator: interaction.guild.voiceAdapterCreator,
    });
    isPlaying = true;
    const connection = getVoiceConnection(interaction.guildId);
    const player = createAudioPlayer();
    const audioFile = playlist.shift() + '.mp3';
    console.log(audioFile);
    const resource = createAudioResource(audioFile, {
        inlineVolume: true,
        metadata:{
            title: 'WTF',
        }
    });
    async function start(){
        player.play(resource);
        try {
            await entersState(player, AudioPlayerStatus.Playing, 5_000);
            console.log('playback started');
        }catch(error){
            console.log(error);
        }
            
    }
    void start();
    connection.subscribe(player);
    player.on(AudioPlayerStatus.Idle, () => connection.destroy());```
carmine timber
carmine timber
obtuse tinsel

just realized: do you install both of these, or just one?

obtuse tinsel

i installed both, time to uninstall ffmpeg-static ¯_(ツ)_/¯

round peak
obtuse tinsel
round peak

oops, ty

round peak

the intent allows it to have voice tho

carmine timber
carmine timber
player.on(AudioPlayerStatus.Idle, () => connection.destroy());

Remove this Line and try again @round peak

round peak

it didnt leave but now it looks like mic is open but nothing playing and hes stuck here

carmine timber

So it means everything is working, now issue only comes to the playing file.

carmine timber
dusty needleBOT

Documentation suggestion for @twilit quarry:
_ ClientVoiceManager
Manages voice connections for the client

round peak

wtf.mp3 which is in the same folder

i put it in same folder as my commands

carmine timber
round peak wtf.mp3 which is in the same folder

Oh, okay you are giving a relative path and playing a relative path is not supported in voice

So do this :

const path = require('path')

const playing_path = path.resolve(audioFile)
const resource = createAudioResource(playing_path, {
        inlineVolume: true,
        metadata:{
            title: 'WTF',
        }
    });
carmine timber
round peak

so it returns full paths now, but the bot was already in discord and never made the sound

twilit quarry
carmine timber
round peak

@carmine timber ```const path = require('path');
const { SlashCommandBuilder } = require('@discordjs/builders');
const { createAudioPlayer, createAudioResource, joinVoiceChannel, entersState, AudioPlayerStatus, getVoiceConnection } = require('@discordjs/voice');

var isPlaying = false;
var playlist = [];
var volume = .7;

module.exports = {
data: new SlashCommandBuilder()
.setName('sd')
.setDescription('play a meme')
.addStringOption(option =>
option.setName('meme')
.setDescription('The Memes')
.setRequired(true)
.addChoice('Stratus, WTF', 'wtf')
.addChoice('Joe?', 'joe')
.addChoice('Cam's brain stroked out', 'camstroked')),
async execute(interaction) {
await interaction.deferReply();
let meme = interaction.options.getString('meme');
playlist.push(meme);
if (!isPlaying){
playSoundFile(interaction);
}
await interaction.followUp('Now playing!');
},
};

async function playSoundFile(interaction){
const connection = await joinVoiceChannel({
channelId: interaction.member.voice.channel.id,
guildId: interaction.guildId,
adapterCreator: interaction.guild.voiceAdapterCreator,
});
isPlaying = true;
//= getVoiceConnection(interaction.guildId);
const player = createAudioPlayer();
const audioFile = playlist.shift() + '.mp3';

const playing_path = path.resolve(audioFile);
console.log(playing_path);
const resource = createAudioResource(playing_path, {
    inlineVolume: true,
    metadata:{
        title: 'WTF',
    }
});
async function start(){
    player.play(resource);
    try {
        await entersState(player, AudioPlayerStatus.Playing, 5000);
        console.log('playback started');
    }catch(error){
        console.log(error);
    }
        
}
void start();
connection.subscribe(player);
//player.on(AudioPlayerStatus.Idle, () => connection.destroy());

}

carmine timber
round peak
- @discordjs/voice: 0.6.0
- prism-media: 1.3.2

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

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

FFmpeg
- version: 4.4-essentials_build-www.gyan.dev
- libopus: yes```
carmine timber
round peak
playback started
playing -----> idle```

happens basically right after each other. sound clip is like 10 sec
carmine timber
round peak
  {
    type: 'ffmpeg pcm',
    to: Node { edges: [Array], type: 'raw' },
    cost: 2,
    transformer: [Function: transformer],
    from: Node { edges: [Array], type: 'arbitrary' }
  },
  {
    type: 'volume transformer',
    to: Node { edges: [Array], type: 'raw' },
    cost: 0.5,
    transformer: [Function: transformer],
    from: Node { edges: [Array], type: 'raw' }
  },
  {
    type: 'opus encoder',
    to: Node { edges: [Array], type: 'opus' },
    cost: 1.5,
    transformer: [Function: transformer],
    from: Node { edges: [Array], type: 'raw' }
  }
]```
carmine timber

This is also good

carmine timber
round peak

i think its a path issue on the file. because its a in a sub folder of the main app and path i think is getting main app path and not subfolder

carmine timber
round peak

no, its returning D:\GIT\Memeroni\wtf.mp3 and needs to be D:\GIT\Memeroni\commands\wtf.mp3

carmine timber

Now check the playing path again

round peak

it worked!

@carmine timber so basically my problems were the intent and rel path. THANK YOU SO MUCH!

carmine timber

No issues 🙂

ebon veldt

any documentations on using ytdl or ffmpeg yet

icy maple

They have their own docs

green marsh
 else if (interaction.commandName === 'vc'){
            await joinVoiceChannel({
                channelId: interaction.member.voice.channel.id,
                guildId: interaction.guildId,
                adapterCreator: interaction.guild.voiceAdapterCreator,
            });
            await interaction.reply('Joined!');        
        }``` 
error :
```await joinVoiceChannel({
                              ^
TypeError: joinVoiceChannel is not a function```
what's this for?
carmine timber
green marsh
carmine timber

👍

atomic socket

Can you make this code work with 13.x?

const { Client, Intents } = require('discord.js');

const client = new Client({
    intents: [
        Intents.FLAGS.GUILDS,
        Intents.FLAGS.GUILD_MESSAGES,
        Intents.FLAGS.GUILD_MEMBERS,
        Intents.FLAGS.GUILD_VOICE_STATES
    ]
});




client.on('ready', () => {
   console.log(client.guilds);
   console.log('ログインしました: ' + client.user.name);
});


client.on('message', async message => {
    if (message.content === "!ping") {
        message.channel.send('pong');

    } else if (message.content === "!getid") {
        message.channel.send(
            `ID: ${message.channel.id}\n` +
            `Mention: <#${message.channel.id}>`
        );
    } else if (message.content === "!getuser") {
        message.channel.send(
            `Name: ${message.author.name}\n` +
            `Mention: <@${message.author.id}>`
        );
    } else if (message.content === "!test") {
        // 送信者がボイスに接続してない?
        if (!message.member.voice.channel) {  // YES: メッセージを出して終了
            message.channel.send("ボイス未接続");

        } else {  // NO: 接続して再生しよう
            // const guild = client.guilds.cache.get("525189808490807296");
            // const channel = guild.channels.cache.get("525189808490807304");
            const channel = message.member.voice.channel;

            if (!channel) return console.log("channel not found");

            message.channel.send("connecting: " + channel.name);

            console.log(channel);

            channel.join().then(connection => {
                console.log("connected!");

                const player = connection.play("sample.mp3");
                player.setVolume(0.25);
                player.on("finish", reason => {
                    connection.disconnect();
                });

            });

        }
    }
});

client.on("guildMemberAdd", (member, guild) => {
    console.log("onGuildMemberAdd");
});






client.login(/*TOKEN*/);
stone loom

help me pls

sacred agate

I'm trying so hard not to freak out. I've been struggling for two days to install a damn module. Can anyone install this node-sodium or sodium?

Error: make libsodium exited with code 2. (MacOS.)

carmine timber
sacred agate
Exit code: 1
Command: node install.js --preinstall
Arguments:
Directory: /Users/laevaintain/Documents/***/node_modules/sodium
Output:
Static libsodium was not found at
sacred agate
carmine timber
carmine timber
sacred agate
carmine timber
sacred agate
carmine timber
sacred agate
sacred agate
carmine timber

👍

stone loom

whenever i put filters on my bot it works but it shows this error :-
⚠️ - Something went wrong ... Error : Error: input stream: write EPIPE

i use replit

please help bros!

stone loom

plss

stuck summit

I need help

carmine timber
carmine timber
stuck summit
sacred agate
stone loom
carmine timber
carmine timber

Wait, you are doing all this in ready state ??

sacred agate
carmine timber
full grove

I have a question and I couldn't find it in the documentation if I have a simple music bot is it possible for the audio to clip if it gets to loud?

carmine timber

I think no it is not possible

twilit anvil

i dont understand the voice docs, what is the audioPlayer

carmine timber

Just like a player like VLC which plays audio content in discord

vocal valley
twilit anvil

yes i mean the guide

const connection = joinVoiceChannel({
    channelId: message.channel.id,
    guildId: message.channel.guild.id,
    adapterCreator: message.channel.guild.voiceAdapterCreator,
});
const player = createAudioPlayer({ behaviors: { noSubscriber: NoSubscriberBehavior.Pause } });
// await entersState(connection, AudioPlayerStatus.Playing, 5000);
player.play(stream)
connection.subscribe(player)
carmine timber

That's the issue

twilit anvil

KEKW ty

hm still cant

carmine timber
twilit anvil
 const connection = joinVoiceChannel({
            channelId: message.member.voice.channel.id,
            guildId: message.channel.guild.id,
            adapterCreator: message.channel.guild.voiceAdapterCreator,
        });
        const player = createAudioPlayer({ behaviors: { noSubscriber: NoSubscriberBehavior.Pause } });
        // await entersState(connection, AudioPlayerStatus.Playing, 5000);
        player.play(stream)
        connection.subscribe(player)
carmine timber
twilit anvil

no

carmine timber
twilit anvil

13.1.0

carmine timber
twilit anvil
const Discord = require('discord.js');
const client = new Discord.Client({
    intents: ['GUILDS', 'GUILD_MESSAGES', 'GUILD_VOICE_STATES']
});
carmine timber
twilit anvil

index.js same file

carmine timber
carmine timber
twilit anvil

messageCreate

carmine timber
twilit anvil

yes

carmine timber
twilit anvil

it throws an error now

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

TypeError: Cannot read property 'once' of undefined
    at AudioPlayer.play (C:\Users\User\Documents\GitHub\libs\node_modules\@discordjs\voice\dist\audio\AudioPlayer.js:221:29)
    at Client.<anonymous> (C:\Users\User\Documents\GitHub\libs\index.js:30:16)
    at processTicksAndRejections (node:internal/process/task_queues:96:5)
carmine timber
twilit anvil

no

hm it does now 😓

sorry for inconvenience

carmine timber
stone loom
carmine timber
stone loom
carmine timber
stone loom

@carmine timber

carmine timber

Playing Audio Issue

sudden hawk

Hi, i was wondering, how can i do a command to set the volume of the player?

glad tulip

Here is my music bot code. The bot joins the voice chat but never reaches the ready state. Does anyone know why?

if (!voiceConn) {
            if (interaction.member instanceof GuildMember && interaction.member.voice.channel) {
                const channel = interaction.member.voice.channel
                voiceConn = joinVoiceChannel({
                    channelId: channel.id,
                    guildId: channel.guild.id,
                    adapterCreator: channel.guild.voiceAdapterCreator as DiscordGatewayAdapterCreator,
                })
                voiceConn.on('error', console.warn)    
            }
            if (!voiceConn) {
                await interaction.followUp('Join a channel and try again')
                return
            }
            try {
                await entersState(voiceConn, VoiceConnectionStatus.Ready, 10e3)
                voiceConn.disconnect()
                voiceConn.destroy()
                await interaction.followUp('Success!')
            } catch (e) {
                console.warn(e)
                await interaction.followUp('Failed to join channel in 10 seconds')
                voiceConn.disconnect()
                voiceConn.destroy()
            }
        } else {
            voiceConn.destroy()
        }
carmine timber
carmine timber
glad tulip
carmine timber
thorn wyvern

bruh I cant even play simple radio stream. in old version i could in 1 line. please help me

let connection = joinVoiceChannel({
            channelId: message.member.voice.channel.id,
            guildId: message.channel.guild.id,
            adapterCreator: message.channel.guild.voiceAdapterCreator,
    })
    
    const player = createAudioPlayer({ behaviors: { noSubscriber: NoSubscriberBehavior.Play } });
        // await entersState(connection, AudioPlayerStatus.Playing, 5000);
    const resource = await createAudioResource("https://radio.sansai.uk/radio/8000/sansai.mp3")
    player.play(resource)
    connection.subscribe(player)
glad tulip
carmine timber Yes, You are missing `GUILD_VOICE_STATES` intent

So I got the bot to connect, and the icon glows green, but no audio plays. I double checked to make sure the path is right and the the file does play audio. Here's the updated code. Any ideas?

await entersState(voiceConn, VoiceConnectionStatus.Ready, 10e3)
const player = createAudioPlayer()
if (!process.env.LEFTIST_ASS_PATH) {
    throw new MusicError('Leftist Ass path undefined')
}
const resource = createAudioResource(createReadStream(process.env.LEFTIST_ASS_PATH), {
    inputType: StreamType.Arbitrary
})
player.play(resource)
player.on('error', error => {
    console.error(`Error: ${error}`)
})
voiceConn.subscribe(player)
                
await interaction.followUp('Playing!')
await entersState(player, AudioPlayerStatus.Idle, 10e3)
voiceConn.destroy()
carmine timber
glad tulip

I type the path into my file explorer and it pull right up

glad tulip
lament quartz

How can I play someone elses stream to a websitev

austere gale

is there any good method on how I can check if my bot is in a vc?

lament quartz

If it exists yes else no

austere gale

hmm

orchid crown
lament quartz
fast moon

how can i stream a video on a vc

fervent estuary

You cannot. That is not a feature bots can utilize

signal crescent

uhhhh, for the lack of a better word, my bot just wont play anything

i copy pasted nearly everything from the tutorial with some changes and installed ffmpeg, made sure the mp3 file is there and so on, but it still doesn't work

const voiceDiscord = require('@discordjs/voice');
[...]
module.exports = async function quiz(client, message, con, prefix, prefixMap, Discord, json, changelogmsg, changelist, rejerr) {
    try {
        const connection = voiceDiscord.joinVoiceChannel({
            channelId: channelId: message.member.voice.channelId,
            guildId: message.channel.guild.id,
            adapterCreator: message.channel.guild.voiceAdapterCreator,
        });
        const Mplayer = voiceDiscord.createAudioPlayer();
        let resource = voiceDiscord.createAudioResource("C:\\Users\\kurisu\\Desktop\\test.mp3");
        Mplayer.play(resource);

        // Play "track.mp3" across two voice connections
        connection.subscribe(Mplayer);
        connection.on(voiceDiscord.VoiceConnectionStatus.Ready, (oldState, newState) => {
            console.log('Connection is in the Ready state!');
        });
        
        Mplayer.on(voiceDiscord.AudioPlayerStatus.Playing, (oldState, newState) => {
            console.log('Audio player is in the Playing state!');
        });
    } catch (error) {
        console.error('Caught ERROR in the quiz:');
        console.error(error);
    }
}
signal crescent

i even uninstalled the old library and its still not working

spare wave

destroy(adapterAvailable?: boolean) What does the parameter adapterAvailable purpose again, doesn't really understand what the document say about it

brazen pine
spare wave

have you enabled GUILD_VOICES_STATES intent

brazen pine

facepalm

i didnt no

just a fyi GUILD_VOICE_STATES works, ofc haha. Issue resolved, thank you @spare wave (spent best part of 2 hours missing a flag)

spare wave

Well, yeah I spent 2hrs looking at my code only to know all it need was discord client restart last time. Sht happen

wispy granite

is sodium vs tweetnacl performance wise a big difference?

i couldn't get sodium to work with docker build so i'm using libsodium-wrappers for now but sometimes it sounds laggy

i'm considering switching to tweetnacl or try to make sodium work again

twilit quarry

Is there a way to attach an error handler to the player, so if a stream disconnects, it is restarted?

Or a way to prevent 401 errors from play-dl.

earnest grove

Hello, I was just wondering how to reconnect a music bot that is already connected to a voice channel through a specific command, because when the bot connects successfully to a certain voice channel then I try to reconnect it to another one it..it doesn't respond, thanks!

subtle granite

Intents.FLAGS.GUILD_VOICES_STATES
RangeError [BITFIELD_INVALID]: Invalid bitfield flag or number: undefined.

minor bison

VOICE without the s

subtle granite

oh

how to check if the bot is playing an audio

subtle granite

i need help

fervent estuary

v12 doesnt support stage channels

fluid loom
            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) {
          code: 'ECONNRESET'
        },```

It seems to happens randomly at about half the stream of the video

fluid loom

Oh

Is there any workaround?

carmine timber
empty torrent

Not if you use ytdl-core. You have to switch to either youtube-dl-exec (example bot uses that) or maybe use the one NIP suggested.

fluid loom

Ok I'll go see their docs

Thank you

carmine timber
strange moth

Dont click

twilit quarry
turbid totem

My bot disconnects after some time from the vc if it doesn't play anything and/or not on is on the channel. I want to implement 24/7 functionality, using npmjs.com/discord-player

carmine timber
turbid totem

I have asked them, tho it is not fault of this package

This is probably how discord handles this

carmine timber
turbid totem
carmine timber

I can get it working with this basic code

Just keep in mind not to quit the console after playing

turbid totem

I know lol

subtle granite

my bot can hear? he has desactived the audio

'-'

next veldt

Does anyone have a code to connect the bot every time it disconnects from the vocal?

austere osprey

How to fix aborted err?

green marsh

bot usually disconnect after 30 minutes
What can I do to prevent this?

fallen atlas

Hey does anyone know how to avoid this error? I get it 30 seconds after I start my music

      reject(new AbortError());
             ^

AbortError: The operation was aborted
    at abortListener (node:events:842:14)
    at EventTarget.<anonymous> (node:events:878:47)
    at EventTarget.[nodejs.internal.kHybridDispatch] (node:internal/event_target:460:20)
    at EventTarget.dispatchEvent (node:internal/event_target:405:26)
    at abortSignal (node:internal/abort_controller:97:10)
    at AbortController.abort (node:internal/abort_controller:122:5)
    at Timeout.<anonymous> (C:\Users\Sayrixx\Desktop\Repo\RadioBoats\node_modules\@discordjs\voice\dist\util\abortAfter.js:10:41)
    at listOnTimeout (node:internal/timers:557:17)
    at processTimers (node:internal/timers:500:7) {
  code: 'ABORT_ERR'
}```

PS: I do not use ytdl-core

austere osprey

I was thinking that this err is related to djs voice

And yup it is

subtle granite

how would I make a bot join a vc and play music?
and does this work for multiple servers? I dont see how bots can be in more then one server vc.

dusty needleBOT

Guide suggestion for @subtle granite:
_ discordjs.guide results:
• Library: Voice Connections

icy maple

Use the exported joinVoiceChannel function

Music bots play music in multiple servers all the time, they prob need alot of RAM tho

storm nova

code: https://hastebin.com/omusaqijup.typescript
error: none
needs: should play the given url
does: When I try to play the link it just says "This interaction failed" with no errors.

edit: forgot to do interaction.reply() but it still gives me "This interaction failed"

empty torrent
weary spade

I have ```js
if (!Member.voice.channel) {
console.log("2 it worked")
player.destroy(oldState.guild.id)
} else {
console.log("we're no strangers to love")
// they both soem people for some reason
};

and eventhough the bot has left the VC, it keeps printing `we're no strangers to love`
plucky basin
async function connectToChannel(channel) {
    const connection = joinVoiceChannel({
        channelId: channel.id,
        guildId: channel.guild.id,
        adapterCreator: channel.guild.voiceAdapterCreator,
    });
    try {
        await entersState(connection, VoiceConnectionStatus.Ready, 30_000);
        return connection;
    } catch (error) {
        connection.destroy();
        throw error;
    }
}```

why this be happening? on heroku i get no error at all, but on my pc this happens

plucky basin

oh yea i didnt think abt that

I forgot that i changed the token to my test bot which is in a completely different server

icy maple

I would store the id in a config file so you can just swap the config files for the different bots

storm nova

@icy maple i hate to ping you but can you take a look at my code and see if you can help?

im a bit desperate im very sorry man

icy maple

Where did you add the reply?

storm nova

yeah i didnt do that but i later fixed it its under player.play(resource)

icy maple

I don’t think all that voice stuff will finish within 3 sec

Or it might bc ur not actually waiting for the connection to become ready

storm nova

how do i make it wait?

icy maple

I would deferReply at the beginning of the command, then editReply after it’s done

storm nova

what?

icy maple

Use the entersState method to make sure the connection actually enters the ready state

Would also check if the audio player enters the playing state

storm nova
await entersState(connection, VoiceConnectionStatus.Ready, 30000);
icy maple

Yea

storm nova

ill try

icy maple

You can import the method and vc status from the voice package

storm nova

yep and the whole slash command is gone pensive_grin

wait its back

and it still says This interaciton failed

carmine timber
austere osprey

@empty torrent idk why you not face it and even the err is thrown from the package of djs voice not other

storm nova

@carmine timber now it just wait 4 seconds and then says the same thing

empty torrent
austere osprey
empty torrent

Please use a bin from next time for large codes.

storm nova

oh yeah forgot about that sorry

empty torrent

What are you trying to achieve again?

storm nova

its not playing anything. idk why it just gives me This interaction failed when I use the slash command. No errors in the console tho

empty torrent
austere osprey
empty torrent
austere osprey Raw

I mean which lib do you use? First of all i suggest using Youtube Data API v3 token to fetch data from api

empty torrent
storm nova

ph thanks

empty torrent
storm nova

yeah.

empty torrent
storm nova

@empty torrent omg im so sorry i didnt have python installed I couldnt install those dependecies lemme try now

empty torrent

Try libsodium-wrappers or tweetnacl

storm nova

i installed those, just sodium i cant.
also the playing still doesnt owrk

empty torrent

You need only on of each category. Not all

storm nova

oh ok

empty torrent
austere osprey

@empty torrent can you provide me code examples?

empty torrent

Surely not. But i can suggest to use simple-youtube-api which uses Simple Youtube API V3 (you need to use your own token.

Or you can try play-dl (I haven’t tried that yet)

austere osprey

I have tried play-dl

It didn't fix it

empty torrent

Okay then use what i use. youtube-dl-exec for creating stream and simple-youtube-api for fetching song data. If the error still persists then it might be your code issue as i don’t get any error with the same setup

carmine timber
carmine timber

🤣

austere osprey

Ok

empty torrent
carmine timber

Yeah very true

subtle granite
0|sfm-backend  | node:events:842
0|sfm-backend  |       reject(new AbortError());
0|sfm-backend  |              ^
0|sfm-backend  | AbortError: The operation was aborted
0|sfm-backend  |     at abortListener (node:events:842:14)
0|sfm-backend  |     at EventTarget.<anonymous> (node:events:878:47)
0|sfm-backend  |     at EventTarget.[nodejs.internal.kHybridDispatch] (node:internal/event_target:460:20)
0|sfm-backend  |     at EventTarget.dispatchEvent (node:internal/event_target:405:26)
0|sfm-backend  |     at abortSignal (node:internal/abort_controller:97:10)
0|sfm-backend  |     at AbortController.abort (node:internal/abort_controller:122:5)
0|sfm-backend  |     at Timeout.<anonymous> (/home/sfm-backend/node_modules/@discordjs/voice/dist/util/abortAfter.js:10:41)
0|sfm-backend  |     at listOnTimeout (node:internal/timers:557:17)
0|sfm-backend  |     at processTimers (node:internal/timers:500:7) {
0|sfm-backend  |   code: 'ABORT_ERR'
0|sfm-backend  | }

Bot joins, plays music for 30 seconds then crashes with this error

spare snow

Code?

subtle granite

It worked before, I just restarted and then the error came up

spare snow

or replace it with a 5 second delay

subtle granite

@spare snow I figured out. It was one channel with missing permissions when the bot tried reconnecting on restart

spare snow

oh, btw your try catch block won't handle the promise rejection

subtle granite
subtle granite
verbal moth

why does the music is stopping after a while with play-dl ?

shrewd goblet

Welp I was having a problem
In discord.js voice
The main problem here is that the bot joins the voice channel
But downs tolay any music
Even though it sends me the message that It is playing (this song)
https://srcb.in/6OzLvz4IGp

spare snow
shrewd goblet
carmine timber
subtle granite

what is a cross postable message

spare snow
fluid loom

Does play_dl work with spotify too?

fervent estuary

not a djs related question

carmine timber
shrewd goblet
carmine timber You need to specify input type while creating a audioResource Specify inputType...

Still not working bro

const ytdl = require('ytdl-core');
const ytSearch = require('yt-search');
const { joinVoiceChannel, createAudioPlayer,StreamType, createAudioResource, AudioPlayerStatus } = require('@discordjs/voice');
const player = createAudioPlayer()
module.exports = {
    name: 'play',
    description: 'Joins and plays a video from youtube',
    execute: async (client, msg, arg, Discord) => {
        const voiceChannel = msg.member.voice.channel;

        if (!voiceChannel) return msg.channel.send('You need to be in a channel to execute this command!');
        const permissions = voiceChannel.permissionsFor(msg.client.user);
        if (!permissions.has('CONNECT')) return msg.channel.send('You dont have the correct permissins');
        if (!permissions.has('SPEAK')) return msg.channel.send('You dont have the correct permissins');
        if (!arg.length) return msg.channel.send('You need to send the second argument!');

        // const validURL = (str) =>{
        //     var regex = /(http|https):\/\/(\w+:{0,1}\w*)?(\S+)(:[0-9]+)?(\/|\/([\w#!:.?+=&%!\-\/]))?/;
        //         return false;
        //     } else {
        //         return true;
        //     }
        // }

        // if(validURL(arg[0])){

        //     const  connection = await voiceChannel.join();
        //     const stream  = ytdl(arg[0], {filter: 'audioonly'});

        //     connection.play(stream, {seek: 0, volume: 1})
        //     .on('finish', () =>{
        //         voiceChannel.leave();
        //         msg.channel.send('leaving channel');
        //     });

        //     await msg.reply(`:thumbsup: Now Playing ***Your Link!***`)

        //     return
        // }

     
        var connection = joinVoiceChannel({
            channelId: voiceChannel.id,
            guildId: voiceChannel.guild.id,
            adapterCreator: msg.channel.guild.voiceAdapterCreator,
        });
       

       
        const videoFinder = async (query) => {
            const videoResult = await ytSearch(query);

            return (videoResult.videos.length > 1) ? videoResult.videos[0] : null;

        }
        const keywords = await arg.join(' ')
        const video = await videoFinder(keywords);

        if (video) {
            const stream = ytdl(video.url, { filter: 'audioonly' });
               
            const player = createAudioPlayer()


            var resource = createAudioResource(stream,{inputType:StreamType.Arbitrary})
            player.play(resource)
      

           connection.subscribe(player);

       
         


            
           
            

           




            await msg.reply(`:thumbsup: Now Playing ***${video.title}***`)
        }
        else{
            msg.reply('No Results Found')
        }
        
    }
}
carmine timber

@fervent estuary Help him

I can't figure out his issues

spare snow

@shrewd goblet Do you get any errors in console?

shrewd goblet

No as i told
and i tried the console.log() things and everyything was fine

empty torrent
shrewd goblet
empty torrent

Seems okay. Can’t say

shrewd goblet
thorn bough

Hey can anyone tell me why my bot is using 15gb ram just for 6 audio player/ audio resources?

the heap is just 1-2gb and the rest is rss

so you can see the difference

Is Ffmpeg instance destroyed after playing?

spare snow

Known issue that I've been dealing with for months now, if you care about memory usage you should switch to lavalink.

thorn bough

Thats why I'm not using lavalink

Well looks like this package isn't meant for production I'll probably switch to lavalink atleast for the time until this package is fixed

shrewd goblet

Well can I get some help or
The whole
Discord.js/voice is wrecked?

fervent estuary
fervent estuary

i havent noticed mem leaks within the lib myself. All i have are caused by my own code

thorn bough

well if I'm doing something to create a memory leak you can notice right?

fervent estuary

cant promise anything

@shrewd goblet can u debug audioPlayer and show me the logs?

thorn bough

hmm

slim raptor

Im currently trying to implement Voice Recording to my Bot by following the voice record example Project. But im getting this Error: TypeError: opus.OpusHead is not a constructor (opus is the prism-media module)
Any Ideas?

spare snow
fervent estuary

thonk

i didnt notice any change in the memory usage of my code when switching from v12 to v13

which makes/made me assume all the memory leaks there are caused by my own code

sacred agate

r u here sensei @carmine timber?

fervent estuary

replace ../../ with @discordjs/voice

that simply points to the lib itself

sacred agate
sacred agate
fervent estuary that simply points to the lib itself

I don't know much about Typescript. I get the definition here through a typescript file.

Definition: const { createDiscordJSAdapter } = require("../adapter").
And returns Error: Cannot find module '../adapter'. Is this because I Define the Typescript file in Javascript? Is there a way to get this in a different way :3

ext: I am not missing any modules.

fervent estuary

if youre using djs v13 u can just use guild.voiceAdapterCreator instead of the createDiscordJSAdapter function shown in the examples

sacred agate
fervent estuary

Yes the bot wont be set as a speaker by default

U will have to do that urself

sacred agate

I believe I will find a few helpful things in the Discord.js Documentation. I'm going to research :3

fervent estuary

👍

sacred agate
fervent estuary 👍

The goddamn bot is raising a hand. He/She (probably he) wants to go on stage but can't.

sacred agate

Okay i got it :3

acoustic gazelle

Hello
I'm having an issue with ffmpeg not being found.
I did npm i ffmpeg-static and it still doesn't works, despite it being in node_modules :

acoustic gazelle

(If anyone have a solution please ping me)

slim raptor

Im currently trying to implement Voice Recording to my Bot by following the voice record example Project. But im getting this Error: TypeError: opus.OpusHead is not a constructor (opus is the prism-media module)
Any Ideas?

orchid crown
slim raptor
slim raptor
orchid crown can you link the example. i would like to look at it

const { SlashCommandBuilder } = require('@discordjs/builders');
const { joinVoiceChannel, EndBehaviorType, VoiceReceiver } = require('@discordjs/voice');
const { User } = require('discord.js');
const { createWriteStream } = require('fs');
const { opus } = require('prism-media');
const { pipeline } = require('stream');
module.exports = {
data: new SlashCommandBuilder()
.setName('join')
.setDescription('Let the Bot join'),
async execute(interaction, client) {
if (!interaction.member.voice){
return interaction.reply({ content: 'You need to be in a Voice Channel first!', ephemeral: true });
}
const connection = joinVoiceChannel({
channelId: interaction.member.voice.channelId,
guildId: interaction.channel.guild.id,
adapterCreator: interaction.channel.guild.voiceAdapterCreator,
selfDeaf: false,
selfMute: true
});
receiver = connection.receiver;
const opusStream = receiver.subscribe(interaction.user.id, {
end: {
behavior: EndBehaviorType.AfterSilence,
duration: 100,
},
});

const oggStream = new opus.OggLogicalBitstream({
    opusHead: new opus.OpusHead({
        channelCount: 2,
        sampleRate: 48000,
    }),
    pageSizeControl: {
        maxPackets: 10,
    },
});

  const filename = `./recordings/${Date.now()}.ogg`;

  const out = createWriteStream(filename);

  console.log(`👂 Started recording ${filename}`);

  pipeline(opusStream, oggStream, out, (err) => {
      if (err) {
          console.warn(`❌ Error recording file ${filename} - ${err.message}`);
      } else {
          console.log(`✅ Recorded ${filename}`);
      }
  });
return interaction.reply('Connected!');
},

};

orchid crown

what example project are you following btw?

finite echo

The bot plays the audio file which is a short 2 or 3 sec file (depending on factors) of ogg format but the audio always lags when it plays

slim raptor
orchid crown
slim raptor
orchid crown
subtle granite

Is there a specific intent I need to play music?

I thought repl.it was stopping me from playing but when i did it in my own files it still didn't play anything

icy maple
subtle granite

Yea i got that one

I made this test script and it still didn't workjs module.exports = async (channel) => { const { createAudioPlayer, createAudioResource, joinVoiceChannel } = require('@discordjs/voice'); const connection = joinVoiceChannel({ channelId: channel.id, guildId: channel.guild.id, adapterCreator: channel.guild.voiceAdapterCreator, }); const player = createAudioPlayer(); const resource = createAudioResource(require('fs').createReadStream(require('path').join(__dirname, 'song.mp3'))); player.play(resource); }

icy maple

Does the bot connect to the vc?

icy maple

to my yt channel
<connection>.subscribe(<player>)

subtle granite

oh yea i forgot, thanks

now i just need to find out why it still wont work with discord-ytdl-core

less goo i got it

storm nova
glass stirrup

I found play-dl 10x better than ytdl core

but it joins and says it's playing things?

storm nova

@glass stirrup yes

glass stirrup

sounds like it's not subscribing

storm nova

connection.subscribe(player); i got this

icy maple

Could be missing the guild voice intents since ur not actually checking if the connection becomes ready

storm nova

yeah i realized and fixed it, but

let rawData = await ytdl.getBasicInfo(args[0], { 'lang': 'en' });
      rawData = {
        url: args[0],
        title: rawData.videoDetails.title,     
      };

on this part how do get the thumbnail of the video?

storm nova
fallen atlas

Hey does anyone know how to do that once my bot is connected to the voice channel if it is a stage channel to put in speaker?

storm nova

im using @discordjs/voice
i just don't understand how to pass player to a different file

      const player = Voice.createAudioPlayer();
      const resource = Voice.createAudioResource(stream);
      player.play(resource);

this. how do i carry player to a different file but keep it in there as well. so I can stop it using a different command

subtle granite

you could do something like client.player = player and then access it from a different file?

glass stirrup

export

storm nova
const music = require('../all/play');
        client.player = music.player;
        client.player.pause();
        await message.reply('stopped!');

cannot read property pause of undefined

south lark

How do I check how many voice channels my bot is in?
I used to do client.voice.connections.size; but I don't know what it is in v13

rose helm

You'll have to track that yourself since djs no longer has voice components

south lark

On another note, how do I play something from a URL in v13?

empty torrent
south lark

Thank you tips_fedora

empty torrent
south lark
south lark

Thank you smiledog

Is there a version not in typescript by any chance 🥺

south lark

Why is djs voice so much more difficult than it used to be, or is that just me HmmSip

icy maple
south lark

The guide wasn't really helpful to me.

How do I make the bot just join the voice channel.
I can't even get passed that sweat_ani

icy maple

Use the joinVoiceChannel function

dusty needleBOT
icy maple

Then await entersState(connection, "ready", 30e3)

south lark

It's not working yikes

Is this right?

var channelId = msg.member.voice.channelID;

const connection = joinVoiceChannel({
          channelId: channelId,
          guildId: msg.guild.id,
          adapterCreator: msg.guild.voiceAdapterCreator,
        });
icy maple

It’s .channelId (small d)

south lark

Oh

I swear, if that was the reason why all my code wasn't working this whole time bruh
Like all of it

It joined the voice channel floosh

south lark
icy maple

What kind of url?

south lark

Like just an https:// kinda thing

icy maple

Is it a link to a mp3 file?

south lark

Yes

The actual URL doesn't end in .mp3, but I'm pretty sure it's still an mp3 url link thingy.

icy maple

It has to be a direct link to the mp3, like if you open it in a browser, it will ask you to download it

south lark

Well I think that's how I was doing it before, so it should work. But it does actually play in the browser.
I'm rewriting from v12 voice code into v13 yus

icy maple

You could use smth like node-fetch to fetch the url

south lark

I didn't have to use anything specific for the URL previously so I think it will work, just what code would I use?

icy maple

I mean, this package is completely different from v12

Voice package introduces audio players and audio resource, which wasn’t a thing in v12

south lark

Well what would be the code to play from URL, just tell me that
If it is an mp3 type thingy

icy maple

You need to get a stream from the url first

Then createAudioResource to make a resource from the stream

south lark

Can you give an example of the stream part

icy maple
const res = await fetch(…)
if (!res.ok) return // handle http error
const stream = res.body```

From there, you gotta createAudioPlayer to get a player, subscribe the connection to the player, then play the resource via the player

This is all described in the audio player and audio resource section of the guide

south lark
const res = await fetch(url)
                    ^

ReferenceError: fetch is not defined
icy maple

I used node-fetch as an example bc it comes with d.js

south lark

I don't understand
Like how do I use it if it comes with djs?

south lark
icy maple

Show code

void wadi
south lark
south lark
icy maple Show code
const connection = joinVoiceChannel({
          channelId: channelId,
          guildId: msg.guild.id,
          adapterCreator: msg.guild.voiceAdapterCreator,
          selfDeaf: false
        });
        await entersState(connection, "ready", 30e3)
        const fetch = (...args) => import('node-fetch').then(({default: fetch}) => fetch(...args));
        const res = await fetch(url)
        if (!res.ok) return // handle http error
        const stream = res.body
        const resource = createAudioResource(stream);
        player.play(resource);
icy maple

Just do const fetch = require("node-fetch")

If you installed node-fetch, make sure it’s v2

south lark

It's v3....

icy maple

Then downgrade it

south lark
const connection = joinVoiceChannel({
          channelId: channelId,
          guildId: msg.guild.id,
          adapterCreator: msg.guild.voiceAdapterCreator,
          selfDeaf: false
        });
        await entersState(connection, "ready", 30e3)
        const fetch = require ("node-fetch")
        const res = await fetch(url)
        if (!res.ok) return // handle http error
        const stream = res.body
        const resource = createAudioResource(stream);
        player.play(resource);

still not working Sadge

icy maple

Is there an error?

south lark

No error

void wadi

does it join a channel?

south lark
icy maple

Can you actually throw or log smth instead of just returning?

south lark
icy maple Can you actually throw or log smth instead of just returning?

Suggestions

const connection = joinVoiceChannel({
          channelId: channelId,
          guildId: msg.guild.id,
          adapterCreator: msg.guild.voiceAdapterCreator,
          selfDeaf: false
        });
        await entersState(connection, "ready", 30e3)
        const fetch = require ("node-fetch")
        const res = await fetch(url).catch(e => console.log(e))
        const stream = res.body
        const resource = createAudioResource(stream);
        player.play(resource);

Still nothing logging sigh

icy maple

Catching isn’t enough

That’s why I added in the if statement

You have to actually log smth or throw an error in the return statement tho

subtle granite

Can discord.js play m3u8 url stream?

icy maple

Yea, just gotta read the text file and get a stream from the mp3 urls

south lark
icy maple Yea, just gotta read the text file and get a stream from the mp3 urls
const connection = joinVoiceChannel({
          channelId: channelId,
          guildId: msg.guild.id,
          adapterCreator: msg.guild.voiceAdapterCreator,
          selfDeaf: false
        });
        await entersState(connection, "ready", 30e3)
        const fetch = require ("node-fetch")
        const res = await fetch(url)
        if (!res.ok) console.log("Had a problem fetching!")  // handle http error
        const stream = res.body
        const resource = createAudioResource(stream);
        player.play(resource);

Still no errors Confused_Dog

icy maple

You didn’t subscribe the connection to the player

connection.subscribe(player)

south lark

Oh

Okay finally it works floosh

south lark
icy maple `connection.subscribe(player)`

So, the way this command works as it is right now, is that everytime someone runs the command, it plays the sound. Will I have memory-leak problems with the way it is right now?

icy maple

It might be possible

south lark

So like, I think it's subscribing to the player everytime the command is run, do I need to make a system to have it check if there is already an existing subscription first?

icy maple

Yea

<Connection>.state.subscription

south lark
shrewd goblet
subtle granite

What to do?

slender imp
// #==============================================================
// # Imports # //

const {
  createAudioPlayer,
  createAudioResource,
  joinVoiceChannel,
  AudioPlayerStatus,
} = require("@discordjs/voice");
// #==============================================================

module.exports = async function (msg, args) {
  const channel = msg.member.voice.channelId;

  if (!channel) msg.channel.send("Join voice channel and try again");

  const player = createAudioPlayer();
  const resource = createAudioResource("../Audio/sample.mp3");

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

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

The bot is joining the vc but the audio is not audible and the bot is showing green around it always. What to do?

subtle granite

How do I make my bot play something?

distant osprey
tall apex

how do i get the voice channel someone(the user who wrote the message msg) is in? i tried with msg.member.voice.channel but that deos not update when i leave or join another one. it only updates if i restart the bot

distant osprey

did you enable GUILD_VOICE_STATES intent?

tall apex

ah no i didn't, you see that's why i hate that you can't just enable all of them

distant osprey

you shouldn't

tall apex

why though?

distant osprey

you just have to enable what you need, not "all"

tall apex

but what if i need all or just don't want to bother searching for every single intent i need

distant osprey

you can just add this number to intents parameter

earnest grove

Hello, the client stops playing the music when I move it via discord from a vc to another..can I stop this?

green marsh
    joinVoiceChannel({
        channelId: '820534941049421844',
        guildId: '748914550082109541',
    adapterCreator: channel.guild.voiceAdapterCreator,
    });```What should I set adapterCreator?
carmine timber
green marsh

GC_Florks_think

carmine timber
earnest grove

If you can be more specific.

earnest grove

Okay I will look into that, thanks for the help much appreciated.

carmine timber

👍

tall apex
tall apex
distant osprey

intents: number

green marsh
cold snow

Is receiving audio supported in v13? I cannot find any documentation

last zinc

how do I mkae the bot join the vc, I have the package installed but this doesn't make it join

last zinc

ok, thanks

rigid parcel

How to make join Vc in v13

fallen atlas

Hey does anyone know how to do that once my bot is connected to the voice channel if it is a stage channel to put in speaker?

fervent estuary

not a voice related question

subtle granite
shrewd goblet
storm nova

how to pause and unpause with @discordjs/voice

tall apex

how much better is sodium compared to libsodium-wrappers? i'm having problems installing sodium

storm nova

just do npm i libsodium-wrappers @tall apex dw about sodium

subtle granite

How do I skip to a certain time in the song?

orchid crown

is there a good way to tell if someone in my bots vc is speaking or not??

digital pagoda

any idea why it'd be telling me "adapterCreator is not a function"

rose saffron

Hey is there a way I can get a voice channel for a guild after a bot has restarted?

For instance: if my bot joins a voice channel, the bot process is killed, but the bot is still in the voice channel

Can I still get that voice channel with js getVoiceConnection after the bot logs back in?
Or is that data deleted on kill?

rose saffron
blazing arch

hey, i'm updating my discord music bot from v12 to v13, and i'm getting the following error : ```console
/home/container/node_modules/@discordjs/voice/dist/VoiceConnection.js:446
const subscription = player'subscribe';
^

TypeError: player.subscribe is not a function
at VoiceConnection.subscribe (/home/container/node_modules/@discordjs/voice/dist/VoiceConnection.js:446:49)
at runVideo (/home/container/nightmusic/index.js:46:35)
at processTicksAndRejections (node:internal/process/task_queues:96:5)my codejs
const server = servers.get(message.guild.id);

const player = await ytdl(server.currentVideo.url, { filter: 'audioonly' });
const voiceChannel = message.member.voice.channel;
const connection = getVoiceConnection(message.guild.id);
const dispatcher = connection.subscribe(player);```

mp me for an answer

south lark
blazing arch

ok thx i will try

south lark

Is anyone available to help me with voice receiving stuff? I have code that works with v12 for voice receiving but I'm trying to update it to v13 and am struggling. 🥺

And on another note, how can I check if a voice channel is a stage channel and tell the bot to automatically move to speaker if it is?

And also, when will there be an official guide for voice receiving on the guide website? It would be very useful because I often find myself getting lost with the current things.

blazing arch
/home/container/node_modules/@discordjs/voice/dist/audio/AudioPlayer.js:221
        resource.playStream.once('error', onStreamError);
                            ^

TypeError: Cannot read property 'once' of undefined
    at AudioPlayer.play (/home/container/node_modules/@discordjs/voice/dist/audio/AudioPlayer.js:221:29)
    at runVideo (/home/container/nightmusic/index.js:48:36)
    at processTicksAndRejections (node:internal/process/task_queues:96:5)``` trying to do : ```js
const server = servers.get(message.guild.id);

    const audioPlayer = createAudioPlayer();
    const player = await ytdl(server.currentVideo.url, { filter: 'audioonly' });
    const voiceChannel = message.member.voice.channel;
    const connection = getVoiceConnection(message.guild.id);
    const dispatcher = audioPlayer.play(player);```
south lark
blazing arch

bruh

i'm stupid

south lark

You should use resource like

player.play(resource)

And resource should be something like:

 const resource = createAudioResource(stream);

With stream being the mp3 link to what u are playing

blazing arch

ok thx a lot 🙂

south lark
blazing arch

and what is player ?

south lark

Just take a look at the music bot example, that should help tips_fedora

blazing arch

fine

south lark

Is anyone available to help me with voice receiving stuff? I have code that works with v12 for voice receiving but I'm trying to update it to v13 and am struggling. 🥺
And on another note, how can I check if a voice channel is a stage channel and tell the bot to automatically move to speaker if it is?
And also, when will there be an official guide for voice receiving on the guide website? It would be very useful because I often find myself getting lost with the current things.

dusty needleBOT

Guide suggestion for @south lark:
_ discordjs.guide results:
• Library: Voice Connections
• Additional Information: Voice

sacred cove

there's the voice guide

south lark
subtle granite

How do I get my BOT into the call using discordjs/voice, I didn't find it in the docs

rose saffron

Can you set the bitrate of an audio resource?

I know you could in d.js v12, with

connection.play(..., { bitrate: 128000 })```
last zinc

is there a way to check if the bot is already in the voice channel?

south lark
last zinc

ok

last zinc

not like that

icy maple

You can check <Guild>.me.voice.channelId

Or getVoiceConnection(<Guild>.id) if ur looking specifically for a voice connection via the package

last zinc

ok

it worked

south lark

@icy maple how can I check if my bot joined a stage channel and have it automatically make itself speaker?
Is that posssible?

icy maple

<Guild>.me.voice.setSuppressed(false)

south lark

So that checks if it's able to talk I assume. How do I make it make itself speaker?

south lark
icy maple
south lark
icy maple Yep

Well how do I make itself speaker than?
If it just checks if it can talk or not.

icy maple

That is how you make it a speaker

south lark

OOOOH, I understand now

icy maple

I think the property to check if it’s a speaker is just .suppressed

south lark

Do I need to run it in an if statement of some sort to check if it's in a stage channel or regular channel or will it work just on its own?

icy maple

You should check if it’s a stage channel

south lark

Okay, I understand. Thanks tips_fedora

south lark
icy maple

Can you show the line?

south lark

I just put

msg.guild.me.voice.setSuppressed(false)

What permissions does the bot need? I got a permission error when I tried it again.

icy maple
south lark

It worked when I gave it admin perms but I don't want the bot to have admin perms. Is there a specific permission I can give it for it to work?

icy maple

Priority Speaker

south lark

Ah

subtle granite

How do I skip to a certain time of a song?

south lark
icy maple

Show code

south lark

Oh wait I may have fixed it.

icy maple
subtle granite

oh ok

south lark

Nevermind it didn't Sadge

icy maple

Normally, you would handle that when getting the stream

south lark

I was doing

if (msg.guild.me.voice.setSuppressed === true) msg.guild.me.voice.setSuppressed(false)

I also tried

if (msg.guild.me.voice.supressed) msg.guild.me.voice.setSupressed(false)
icy maple

Or you have to download the entire stream then seek

icy maple

It’s .suppress

south lark

Oh

south lark
icy maple

Yes

south lark

That didn't work crycat
No error, just flat out didn't run the code.

icy maple

Can you log the condition then?

south lark

It logs as undefined.

Hold up, I see the paramater

south lark
icy maple

Oh, I misspelled it

suppress

south lark

I misspelled it as well when I typed it out in my own code kek
It's fixed now tips_fedora

icy maple

That’s why I use js docs or ts, lol

south lark

The priority speaker permission isn't allowing it to make itself speaker in the stage channel. Only giving it administrator seems to be working as of now pepehmmNoBG

icy maple

Time to binary search for the correct permission

Unless it’s in the api docs

It’s mute members apparently

south lark
icy maple

I guess ppl who want to speak and be heard can mute everyone else? ¯_(ツ)_/¯

storm nova

in depth guide on looping?

icy maple

Just make a Queue structure

shrewd goblet

How can I use lavalink

carmine timber

not djs-voice related

sudden idol

How do i connect to a voice channel? / Make the bot join a vc

junior folio

what's this error, it's only happens sometimes when listening to songs 4675_ablobthinkingfast

carmine timber
junior folio
carmine timber
void wadi

how come when I change the volume while audio is playing it so much lower than when it starts

void wadi

when a song is first played

ressource.volume.setVolume((playQueue == null) ? 1 : playQueue.volume);

When a song is playing and volume changed:

connectionOG._state.subscription.player._state.resource.volume.setVolume(queue.volume / 100);
carmine timber
void wadi

it loads it from database

carmine timber
carmine timber
void wadi

but I put for example 100 and it sounds like it sets at 50

carmine timber
void wadi

yes I know, but like I said, 100 / 100 = 1. When I put the volume in the database at 1. It sounds like normal. Change it to 1 while it plays, makes it sounds like its 0.5

carmine timber

Oh okay, Let me test that .

void wadi

🙏

void wadi
carmine timber
void wadi

weird

sonic flint
    at Timeout._onTimeout (E:\Bot making\Speech-Recognition-Bot-master\node_modules\fluent-ffmpeg\lib\processor.js:491:25)
    at listOnTimeout (internal/timers.js:557:17)
    at processTimers (internal/timers.js:500:7)
Emitted 'error' event on FfmpegCommand instance at:
    at emitEnd (E:\Bot making\Speech-Recognition-Bot-master\node_modules\fluent-ffmpeg\lib\processor.js:424:16)
    at Timeout._onTimeout (E:\Bot making\Speech-Recognition-Bot-master\node_modules\fluent-ffmpeg\lib\processor.js:491:17)
    at listOnTimeout (internal/timers.js:557:17)
    at processTimers (internal/timers.js:500:7)
PS E:\Bot making\Speech-Recognition-Bot-master> ```

anyone pls help me out what is the error

carmine timber
void wadi
carmine timber

LOL

sonic flint
carmine timber
fathom coyote

Cannot destroy VoiceConnection - it has already been destroyed

What's wrong with me getting this error?

carmine timber
junior folio

how to play youtube live stream in @discordjs/voice?

ebon trout

How can i list the active voice connections of a bot? in djs v13

junior folio
carmine timber
ripe nacelle

Is it normal that installing sodium takes a long time on ubuntu?

subtle granite

hello

how can I seek an audio?

 const resource = createAudioResource('./audio.mp3');
player.play(resource);
earnest grove
carmine timber
earnest grove

Seemed that people were asking about in here so I did the same, anyway appreciated tho!

carmine timber

No, don't ask their library questions here.

earnest grove

Ye got it

carmine timber
subtle granite how can I seek an audio?
const FFMPEG_OPUS_ARGUMENTS = [
        '-analyzeduration',
        '0',
        '-loglevel',
        '0',
        '-acodec',
        'libopus',
        '-f',
        'opus',
        '-ar',
        '48000',
        '-ac',
        '2',
    ];

const ffmpeg_instance = new FFmpeg({
        args: ["-ss", 1, "-i", "playing url", ...FFMPEG_OPUS_ARGUMENTS]
    }); //Seeks 1 second

const resource = createAudioResource(ffmpeg_instance, { inputType : StreamType.OggOpus })

This should work i think

deft wedge

Is there any way a single bot can play in multiple channels of same server? Someone told me that's possible with @discordjs/voice

subtle granite

Can i get a link to the guide for voice?

lofty condor

How I can let a bot leave the voice channel with guild id?

spare snow
lofty condor

ok thx

carmine timber

Read these lines carefully.

subtle granite
subtle granite

yes, one bot cannot join multiple channels of the same server I know that.

carmine timber

if they wish to run more than one bot in the process.

river mural

how can i see if a user is in a voice channel with interactions

glass stirrup

like if who triggered the interaction is in a voicechannel?

this is my /play command. Everything works perfect.. except: If a song is playing and someone uses /play. the bot creates a new connection instead of updating the existing one. since the connection is set to destroy after 10 secs of idle the bot crashes since you cannot destroy a connection twice.

would love some help here been staring for too long

next leaf

How to replace this code to djs v13 voice

const broadcast = client.voice.createBroadcast();
const dispatcher = broadcast.play(URL exemple :"http://icecast.funradio.fr/fun-1-44-128?listen=webCwsBCggNCQgLDQUGBAcGBg");
distant osprey

djs v13 has nothing to do with voice. It is @discordjs/voice now

green marsh
    console.log('Ready!');
    const connection = joinVoiceChannel({
        channelId: '820534941049421844',
        guildId: '748914550082109541',
        adapterCreator: ... .voiceAdapterCreator,
    });
});```What should I set adapterCreator?
next leaf
green marsh
next leaf

@green marsh

green marsh

it's not massage ....

next leaf

i don't see the "ready"

green marsh

hmmmm. bruh

glass stirrup
const { joinVoiceChannel } = require('@discordjs/voice');

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

😐 i know it but what in ready
it's don't have channel.guild GC1_pepe_walkaway

glass stirrup

so as soon as the bot starts you want it in a voice chat?

green marsh

sure just connect and afk in voice

pong! GC1_pepe_sweak

glass stirrup

whats your code look like

lime bough

How do i do so my music bot leaves after 5 minutes when being left alone?

And that it will display a message too? That y’all left me alone so I disconnected?

glass stirrup

code?

lime bough
glass stirrup

whats your code

lime bough
glass stirrup

post...your....code....

lime bough

What code bro

I have plenty of codes