#archive-voice
30636 messages · Page 13 of 31
will that work?
lemme try!
hey guys, is there some way in v13 to get the audioplayer equivalent of streamTime?
yes
amazing thank you
pushed the change, btw how can we track when a particular user joins and leaves a voice channel?
Documentation suggestion for @torn shoal:
(event) Client#voiceStateUpdate
Emitted whenever a member changes voice state - e.g. joins/leaves a channel, mutes/unmutes.
got the same error again btw
@carmine timber
Wait, I got it
player.on(AudioPlayerStatus.Idle, () => {
setTimeout(() => {
let checkConnection = getVoiceConnection(message.guild.id);
if(checkConnection){
checkConnection.destroy()}
else return;
}, 300000);;
})
@torn shoal Try this one
k
@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 ??
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
This fixed it Ig!
didn't get the error for now
but what would audio player be equalled to guys I dont understand help please ddddddd
It didn't went to IDLE in my testing, going to create a issue in voice soon.
Ooh actually, it may take 100ms to enter idle
If you do .stop(true), it will always go to idle
I guess the closest thing is streamdispatcher
sorry, .stop(false) will work
thats not even a thing??
Oh you mean what the variable AudioPlayer is?
yes
Look at the audio player page in the guide
But why did <AudioPlayer>.stop() without boolean won't work ??
It will work eventually but not immediately
oh nvm
By default it plays 100ms of silence before ending
Ok let me run few more tests, Then will talk
Ok
It may also be 200ms cannot remember
No sorry it is stop(true) was right the first time lol
lol
@vocal valley sorry for ping
https://i.imgur.com/Fgg2eQz.png
but would this line just play the specified track in the specified location?
nope, that just loads the track basically
ah
player.play(resource) plays the track on a player, and connection.subscribe(player) means the player will play to that voice connection
thanks man
wait what would connection1 and connection2 be equal too would i just use the same one from my join.js command?
connection1 and connection2 are just connections you get from joinVoiceChannel
Apparently, this makes player reach idle state 🙂
But I am still wondering why would <AudioPlayer>.stop() or .stop(false) won't work ??
ah ok
So if you stop playback without silence after it, the discord client can make weird audio noises because the opus decoder wasn't expecting to end immediately
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
Okay
.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
Okay I understand now, thanks
Np
@vocal valley but now i get this strange error https://hatebin.com/utvcqhitqa
this is my code https://hastebin.com/ociqorojaj.typescript
You are creating duplicate application commands as Error says
yeah i realized that right after posting
https://hatebin.com/psqgouilwn
the bot starts going green in vc but i dont hear anything i dont get any errors
its not playing never gonna give you up :(
You can't play youtube url like that
how do i do it with yt urls?
You need to use play-dl or other youtube module to convert it into stream
how do I get a vc in a guild by name
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
s it ok for a bot to join stage channel
const stageChannel = message.member.stage.channel;
stageChannel.join()```
Guide suggestion for @subtle condor:
discordjs.guide results:
• Library: Cheat sheet - Creation
in discord.js v13, something like voiceChannels.members.size
ah okay, but how do I access voiceChannels property ?
I would appreciate it if you can send the docs where exactly I should look
the voice library doesn't track people in voice channels, but discord.js does
Thank you, I will take a look
hi why does my discord bot voice connection stay in "signalling" status
may be you don't have GUILD_VOICE_STATES intent
would they fix the aborted error ?
Just switch to play-dl, no need of them to fix that error
play dl is like ytdl ?
much better than ytdl-core in many aspects.
hmm okay ill try
is there a doc for it ?
For pre-built examples, go to examples folder
ty
upgrade quality audio from local file?
how do you set self-deaf in a guild? In v12 there was the guild voice property but it's not a thing anymore
Do you mean something like that?
oh there it is, perfect
I think you can log the connection object in order to see further information about such things
well it's enough to have self deaf for the connection, I won't need to turn it on and off on-the-fly
(Use node --trace-warnings ... to show where the warning was created)```
what is this?
maybe u have too much subscribers
is there a way to upgrade music quality with play-dl ?
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
guys how do you make so your music bot leaves after like 5 minutes when no one is in the voice channel?
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
Aborted error is from ytdl-core.
No issues with your code
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!");
});```
You forgot to add GUILD_VOICE_STATES intent
You need ffmpeg to convert it into a better quality stream if you want to have more quality. The quality you get with it is same as you can get by youtube.
Thank you!
I see. Why does the voice connection never change to ready status in that try catch then?
@shut nexus You need this maybe ^^
Anyone have/seen issues with songs skipping/cutting out in during the song? I'm using youtube-dl-exec for reference, not ytdl
is there any kind of player event when the player stops playing audio due to the audio file being finished?
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!
I bet you're right... thank you
Which live stream url you are talking about ??
Its my own website
Oh, then go for ffmpeg no other options
If you directly create resource with url in createAudioResource, voice will use ffmpeg eventually.
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?
So I guess I don't have to convert that manually I can directly put the stream link!
why do voice connection events emit multiple times at once?
Why it's eating a very lot of memory lol ?
I'm just at 10GB...
hi and sorry for the ping, do you know how to fix the age verification error on play-dl?
While getting info from url
Accede para confirmar tu edad
Age verification is out of scope for play-dl, switch to other youtube alternative ( ytdl - core )which lets you login with cookies
Code pls.
It's really not a code issue
So what is it ??
My bot work well, I just have a fucking lot of memory usage.
10 hours uptime, 11GB usage memory..
So, your code has some insane memory leaks somewhere
--> 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
what is the problem
@discordjs/voice
Remove the dot
oh thanks
https://hastebin.com/uyuboxarac.typescript
how is option not defined I did that in line 12
Anyone know why a ytdl livestream bot would die with AudioPlayerError: Aborted?
i come from ytdl-core but it is to laggy and it seems don't work using my age verified cookies 👀
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
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..?

You didn’t subscribe the connection to the player
<connection>.subscribe(<player>)
Ah, thank you, it works now.
How do I check if the bot is a speaker in a stage channel?
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.
For youtube-dl-exec, you need to install python 2 on the system as well. Not python 3
Oh, ok.
Node v16.7.0, Python 2.7.18. Anything else I might have missed?
I'm assuming all the other dependacy like opus etc stated on the guide is installed. So nothing else,
{
"name": "create_name",
"version": "1.0.0",
"main": "index.js",
"license": "MIT",
"engines": {
"node": "16.x"
},
"scripts": {
"build": "echo prebuilt",
"start": "node index"
},
"dependencies": {
"@discordjs/opus": "^0.6.0",
"@discordjs/voice": "^0.6.0",
"discord.js": "^13.1.0",
"ffmpeg-static": "^4.4.0",
"tweetnacl": "^1.0.3",
"youtube-dl-exec": "^1.2.5"
}
}```
Still does it, can't hear anything.
If there something else missing, not really sure
youtube-dl-exec should work with a livestream, right?
Yes
hi 
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 👀
We are not ytdl-core support. Please head to theirs
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
If you want play livestream videos of YouTube, you can try play-dl
Just a recommendation.
^^ I took that advice. 10/10 better
As far as I can think, you are creating a new player whenever you stop or disconnect bot from vc. If that's the case, then your old player will emit this function whenever it reaches idle state.
If you could explain more how your code functions, it would help me to figure out the problem more.
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
Post it
can someone send me a guide to djs voice
tysm
Thanks!
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,
});
}
})```
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?
Documentation suggestion for @terse smelt from @carmine timber:
VoiceState#setSuppressed()
Suppress/unsuppress the user. Only applicable for stage channels.
You forgot to define channel
how do i do that?
define like :
let channel = interaction.member.voice.channel
ok thanks! ill try
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?
You need to check channel type before running this command
Documentation suggestion for @terse smelt:
StageChannel#type
The type of the channel
Gotcha, will make a check
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)
you were told to read pins
there is no pinned message for me
ok tnx
i read it but this isnt what i want !!
you don't read our messages, do you?
how do you check if the player is paused? In v12 there was the dispatcher.paused property
oh I see
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?
I think it might have todo with maxMissedFrames
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(?)
Which line of code exactly causes the issue ??
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
Documentation suggestion for @terse smelt:
StageChannel#stageInstance
The stage instance of this stage channel, if it exists
@valid marsh how can i make my bot join stage?
See the guide in pins
Just like u join a voice channel
Doesn't seem stageInstance has if it's open or not, unless I'm missing that in it somewhere
yess
Anyone?
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.
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
@terse smelt Why don't you just check if the topic of the stage is set?
If there's an instance, doesn't that mean there is one?
Stage channels can be without topics
I know but in his code he sets it
And I think topic can not be null according to the docs
This is true. I could try that
Yeah try the topic of the instance, rather than the channel
But even if bot is not there/restarts, the channel topic is still set
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 ?
wait nvm overthought it a sec
Well audio is undefined
yes but why ?
What are you trying to do?
i catched the error but the bot still crash...
Well pdl can be undefined too there, we don't know much
playing an audio
Just have a look at the guide in the pins
pdl is play-dl module
ok i'll try
I wish someone could help me with my problem
👑 you dropped this, thank you very much. Been battling this check for a bit and never thought of doing it this way
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())
},
}
Did you npm install libsodium-wrappers?
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
@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
added it, still not working :(
@timber crystal Do you have the intent for voice defined
VOICE_STATE_UPDATES
you're a genius, thank you so much
did i miss that or is it not in the guide?
I don't know if its in the guide but its required
Otherwise the bot does not know whether it has connected
is it possible to create a seperate node process which just deals with playing audio?
Require stack:
- /root/node_modules/@discordjs/opus/lib/index.js
- /root/funradio/index.js```
What are you trying to do?
Did you install @discordjs/opus?
hes
And the other required dependencies?
I have installed all the modules
Moment , @discordjs/opus, opusscript , opus
prims-media
@discordjs/voice, ffmpeg and sodium?
yes all
I can't see what the problem is from your error
Can you show the code that you are trying to run?
you want to have access to my vps?
No...
I only want to see what you are trying to do with your bot
I show which line? because it is long
funradio/index.js
ok, but I can't install the sodium module
Thats the problem
You either need sodium or libsodium-wrappers
Install libsodium-wrappers instead
npm remove sodium && npm i libsodium-wrappers
You already have it installed
Then thats not the problem
oof , what should i do then?
?
Can you maybe reshare your snippet? i think i was having similar issues would like to see the working snippet
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);```
You can't connect to a text channel
oo, haha, shoot. for some reason i thought that was my channel... i need to find user.channelid
<Member>.voice.channelId
Or otherwise get <VoiceChannel>.id
Yea
it joins the channel but i don't hear anything yet
Music Bot suddenly crashes after 5 to 20 minutes
how to make a 24/7 music bot
@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
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
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
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
Is there any way to fetch all of the currently connected voice channels, if I don't already have them stored somewhere?
it worked, tysm!
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());```
Age Restricted videos are now supported in play-dl
Maybe you are missing GUILD_VOICE_STATES intent.
just realized: do you install both of these, or just one?
Just one
i installed both, time to uninstall ffmpeg-static ¯_(ツ)_/¯
I think you were right... now it joins and i can see it light up but it instantly leaves and i dont hear anything
wrong person - cc @carmine timber
oops, ty
Is your problem fixed ??
no, it joins and i see the voice light up but it leaves right away. not sure
the intent allows it to have voice tho
Is this all the code ?? or you are missing something ??
Oh, I see why it leaves instantly
player.on(AudioPlayerStatus.Idle, () => connection.destroy());
Remove this Line and try again @round peak
it didnt leave but now it looks like mic is open but nothing playing and hes stuck here
So it means everything is working, now issue only comes to the playing file.
What does audioFile console logged ??
Documentation suggestion for @twilit quarry:
ClientVoiceManager
Manages voice connections for the client
wtf.mp3 which is in the same folder
i put it in same folder as my commands
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',
}
});
Did it work ??
so it returns full paths now, but the bot was already in discord and never made the sound
How do I then extract the ChannelID from the adapter?
You can't extract channel ID from adapters. You need to run a loop like :
client.guilds.cache.each((guild) => {
console.log(guild.me.voice.channel.id)
})
@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());
}
👍
Create a new test file and run node test.js
Add this content in test file :
const { generateDependencyReport } = require('@discordjs/voice');
console.log(generateDependencyReport());
- @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```
For more debugging of player, Can you add this line ??
player.on('stateChange', (os,ns) => {console.log(`${os.status} -----> ${ns.status}`)})
This looks all good
playback started
playing -----> idle```
happens basically right after each other. sound clip is like 10 sec
Can you console.log(resource.edges) ??
{
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' }
}
]```
This is also good
Do you have ffmpeg-static or normal ffmpeg ??
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
Check the playing_path, tell me is it correct ??
no, its returning D:\GIT\Memeroni\wtf.mp3 and needs to be D:\GIT\Memeroni\commands\wtf.mp3
Okay, so change this line
const playing_path = path.resolve('./commands' + audioFile);
Now check the playing path again
it worked!
@carmine timber so basically my problems were the intent and rel path. THANK YOU SO MUCH!
No issues 🙂
any documentations on using ytdl or ffmpeg yet
They have their own docs
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?
You need to import joinVoiceChannel from @discordjs/voice
I forgot it
thanks for help
👍
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*/);
help me pls
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.)
Just install libsodium-wrappers. It is ez
Exit code: 1
Command: node install.js --preinstall
Arguments:
Directory: /Users/laevaintain/Documents/***/node_modules/sodium
Output:
Static libsodium was not found at
i need sodium
Then ask their developers, why asking this in djs-voice
bcoz Discord.JS is using this.
But as it is mentioned, you can install any one of the 3 encryption packages.
Isn't it my natural right to ask about something in the Guide? They suggest using Sodium so I'm trying to install it.
It is your natural right, but why not asking the errors to the creator itself ??
This is the most active right now. Maybe there are people who have experienced the error and solved it.
No, sodium installation is kinda outdated, so mostly people prefer libsodium-wrappers
alright let it be as you say
--------------------------------------------------
Core Dependencies
- @discordjs/voice: 0.6.0
- prism-media: 1.3.2
Opus Libraries
- @discordjs/opus: 0.6.0
- opusscript: 0.0.8
Encryption Libraries
- sodium: 3.0.2
- libsodium-wrappers: 0.7.9
- tweetnacl: 1.0.3
FFmpeg
- version: 4.4
- libopus: yes
--------------------------------------------------
Have I installed everything now, including Sodium?
yes all are installed
ow god thank you
👍
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!
I need help
You need ffmpeg static, download it by npm i ffmpeg-static
Download ffmpeg-static by npm i ffmpeg-static
❤️ thx
How do I get the folder path of the .mp3 file? Okay i get it /Users/laevaintain/Documents/Servers/InformationBot/track.mp3
its already installed sir
do you use replit
Do this and let me know : https://discordjs.guide/voice/#debugging-dependencies
Wait, you are doing all this in ready state ??
I don't know what to do I don't understand the guide
Just see this example, it is a radio bot so just change the attachRecorder function with your own createresource function. Rest would be same
https://github.com/discordjs/voice/blob/main/examples/radio-bot/index.js
oh god thank you!
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?
I think no it is not possible
i dont understand the voice docs, what is the audioPlayer
Just like a player like VLC which plays audio content in discord
try the guide before docs
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)
You are trying to connect to a text channel
That's the issue
ty
hm still cant
Show me code now
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)
Bot connects to vc or not ??
no
Do npm ls discord.js
13.1.0
Show me code where you defined client in main file.
const Discord = require('discord.js');
const client = new Discord.Client({
intents: ['GUILDS', 'GUILD_MESSAGES', 'GUILD_VOICE_STATES']
});
Where did you put this code ?? means in which event ??
index.js same file
Show me that part of code where you used this connection code
which client event did you put connection code ??
messageCreate
Are you sure bot doesn't connect to vc ??
yes
Can you do console.log(connection) after creating connection ?
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)
Ignore that, does your bot connect to voice channel or not ??
no
hm it does now 😓
sorry for inconvenience
Oh now the this above error,
Change your code to :
const resource = createAudioResource(stream)
player.play(resource)
i added the packages now what to do?
owh ty
Which package ??
discord.js/voice
Read the guide in pins
@carmine timber
Playing Audio Issue
Hi, i was wondering, how can i do a command to set the volume of the player?
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()
}
Just pass inLineVolume to true while creating a audioResource and then do this :
<AudioResource>.volume.setVolume(0.1)
Show me code where you defined client in main file
Is this what you're looking for?
const client = new Client({
intents: [Intents.FLAGS.GUILDS, Intents.FLAGS.GUILD_MESSAGES],
})
Yes, You are missing GUILD_VOICE_STATES intent
My hero
k tysm
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)
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()
Maybe your path is relative path.
It's absolute
I type the path into my file explorer and it pull right up
Then maybe try to use this :
https://discordjs.guide/voice/audio-resources.html#probing-to-determine-stream-type
Gave that a shot and still no audio
How can I play someone elses stream to a websitev
is there any good method on how I can check if my bot is in a vc?
guild.me.voice.channel
If it exists yes else no
hmm
can you give an example of how to use this? i cant figure it out
if(guild.me.voice.channel || guild.me.voice.channelId){
//Do code for if
} else {
//code for not
}```
how can i stream a video on a vc
You cannot. That is not a feature bots can utilize
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);
}
}
i even uninstalled the old library and its still not working
destroy(adapterAvailable?: boolean) What does the parameter adapterAvailable purpose again, doesn't really understand what the document say about it
I'm having this exact issue, popped some debugging in and my bot's voice status won't move from signalling. Any ideas?
have you enabled GUILD_VOICES_STATES intent

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)
Well, yeah I spent 2hrs looking at my code only to know all it need was discord client restart last time. Sht happen
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
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.
Create a issue here : https://github.com/play-dl/play-dl/issues
Thanks
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!
Intents.FLAGS.GUILD_VOICES_STATES
RangeError [BITFIELD_INVALID]: Invalid bitfield flag or number: undefined.
VOICE without the s
oh
how to check if the bot is playing an audio
i need help
code:https://github.com/SudhanPlayz/Discord-MusicBot
type:music bot
error:not playing songs in stage channels
output from bot:You must be in a voice channel to play something!
v12 doesnt support stage channels
update to v13 or go to #archive-djs-v12-voice-deprecated
ok
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
ytdl-core issue
Oh
Is there any workaround?
play-dl 🙂
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.
Ok I'll go see their docs
Thank you
Live Stream issues fixed by the developer.
Dont click
Thanks!
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
discord-player is a third party package, we don't support 3rd party packages.
Ask this to their developers.
I have asked them, tho it is not fault of this package
This is probably how discord handles this
It is not the problem of discordjs/voice also.
I have my bot connected to vc for 24/7 without any issues.
could you show the code you are using?
I can get it working with this basic code
Just keep in mind not to quit the console after playing
I know lol
my bot can hear? he has desactived the audio
'-'
Does anyone have a code to connect the bot every time it disconnects from the vocal?
How to fix aborted err?
bot usually disconnect after 30 minutes
What can I do to prevent this?
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
I was thinking that this err is related to djs voice
And yup it is
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.
Guide suggestion for @subtle granite:
discordjs.guide results:
• Library: Voice Connections
Use the exported joinVoiceChannel function
Music bots play music in multiple servers all the time, they prob need
of RAM tho
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"
No it’s not. I’m playing music simultaneously in 3 servers for hours, never faced that error once.
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`
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
The channel is undefined
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
I would store the id in a config file so you can just swap the config files for the different bots
@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
Where did you add the reply?
yeah i didnt do that but i later fixed it its under player.play(resource)
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
how do i make it wait?
I would deferReply at the beginning of the command, then editReply after it’s done
what?
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
await entersState(connection, VoiceConnectionStatus.Ready, 30000);
Yea
ill try
You can import the method and vc status from the voice package
yep and the whole slash command is gone 
wait its back
and it still says This interaciton failed
Your code is taking long to execute and by that time interaction token becomes invalid, so use this one
https://discordjs.guide/interactions/replying-to-slash-commands.html#deferred-responses
@empty torrent idk why you not face it and even the err is thrown from the package of djs voice not other
@carmine timber now it just wait 4 seconds and then says the same thing
Because the error is not from voice as i also said earlier. I never faced that error since i stopped using ytdl-core and started using youtube-dl-exec.
That happens because 'ytdl-core' stream ends unexpectedly while the resource is playing, thus the error shows up as voice error.
Can you show your code?
I am also using youtube-dl-exec but same err
Please use a bin from next time for large codes.
oh yeah forgot about that sorry
https://hastebin.com/oxopofuned.typescript @empty torrent here
What are you trying to achieve again?
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
How do fetch song data?
Raw
I mean which lib do you use? First of all i suggest using Youtube Data API v3 token to fetch data from api
You are doing wrong. You need to get the option value by doing const url = interaction.options.get('query').value
Add that line right after line 18.
Replace interaction.option with url on line 21.
Replace interaction with url on line 22,23 and 25
ph thanks
@empty torrent so I now have
https://hastebin.com/merowosala.typescript
and now it joins vc. says it playings stuffs and is doing nothing.
Do you have all the required modules installed?
yeah.
Try this and show the result - https://discordjs.guide/voice/#debugging-dependencies
@empty torrent omg im so sorry i didnt have python installed I couldnt install those dependecies lemme try now
https://hastebin.com/awicukumov.swift
@empty torrent now i get this when trying to install sodium with npm i sodium
Try libsodium-wrappers or tweetnacl
i installed those, just sodium i cant.
also the playing still doesnt owrk
You need only on of each category. Not all
oh ok
Read the top warning and the check after
@empty torrent can you provide me code examples?
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)
I have tried play-dl
It didn't fix it
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
Don't spread misinformation
Play-dl never had aborted issues.
First try it and then say it.
😆
LOL, Imagine getting aborted error in youtube-dl-exec
🤣
Ok
That’s hilarious
Yeah very true
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
Code?
It worked before, I just restarted and then the error came up
Try deleting the entersState line and see what happens
or replace it with a 5 second delay
@spare snow I figured out. It was one channel with missing permissions when the bot tried reconnecting on restart
oh, btw your try catch block won't handle the promise rejection
Yes I saw that it just throws the error but sometimes its better to see whats wrong
Heyo, someone have an idea ? https://github.com/discordjs/voice/issues/196
why does the music is stopping after a while with play-dl ?
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
You're probably missing the GUILD_VOICE_STATES intent
I have did it as 32767
Which guess includes everything
You need to specify input type while creating a audioResource
Specify inputType as StreamType.Arbitrary
what is a cross postable message
Not related to djs voice, it's related to announcement channels. <Message>.crosspostable is whether the client can publish that message or not.
wrong channnel
I will check
Does play_dl work with spotify too?
not a djs related question
will soon
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')
}
}
}
@fervent estuary Help him
I can't figure out his issues
@shrewd goblet Do you get any errors in console?
No as i told
and i tried the console.log() things and everyything was fine
Try this and show the result - https://discordjs.guide/voice/#debugging-dependencies
--------------------------------------------------
Core Dependencies
- @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
--------------------------------------------------
Seems okay. Can’t say
Bruh
I tried another module called
Discoid music player
And the same problem is there also
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?
Known issue that I've been dealing with for months now, if you care about memory usage you should switch to lavalink.
The bot is a radio bot I don't need audio player per server I need it per cluster.
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
Well can I get some help or
The whole
Discord.js/voice is wrecked?
this package works for production just fine. Its most likely ur own code thats causing that
nope
read it there, the code is there
i havent noticed mem leaks within the lib myself. All i have are caused by my own code
well if I'm doing something to create a memory leak you can notice right?
cant promise anything
@shrewd goblet can u debug audioPlayer and show me the logs?
hmm
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?
Even the music bot example has a huge memory leak. I don't think it's a code thing

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
what is this? import { DiscordGatewayAdapterCreator, DiscordGatewayAdapterLibraryMethods } from '../../';
in https://github.com/discordjs/voice/blob/main/examples/basic/adapter.ts
r u here sensei @carmine timber?
replace ../../ with @discordjs/voice
that simply points to the lib itself
uu thank u.
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.
if youre using djs v13 u can just use guild.voiceAdapterCreator instead of the createDiscordJSAdapter function shown in the examples
oh okay i got it thx :3
To tell the truth, things are getting weird. I completed everything and got music. I can play a '.mp3' file located on my computer. But this time, Bot remains silent on Stage channels. The bot remains in the listener role? So I have to do something separate to get the bot talking on Stage channels?
ext: Client have administrator prilevges.
Yes the bot wont be set as a speaker by default
U will have to do that urself
I believe I will find a few helpful things in the Discord.js Documentation. I'm going to research :3
👍
The goddamn bot is raising a hand. He/She (probably he) wants to go on stage but can't.
Okay i got it :3
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 :
(If anyone have a solution please ping me)
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?
can you link the example. i would like to look at it
sure give me a sec
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!');
},
};
change receiver = connection.receiver: to
let receiver = connection.receiver; give that a try
what example project are you following btw?
still not working :/
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
Do i have to install @discordjs/opus maybe?
i conficts with prism-media. i got an error when trying to install it.
but in the package file its optional
prism wants djs/opus v0.5.0 but latest is v0.6.0 so it errors out. you could try forcing it. or installing an older version of djs/opus
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
You need the GUILD_VOICE_STATES intent
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); }
Does the bot connect to the vc?
Oh wait, you didn’t subscribe
to my yt channel
<connection>.subscribe(<player>)
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
https://hastebin.com/bepezakada.typescript
no errors.
joins and doesnt play anything, tho it says it does.
I found play-dl 10x better than ytdl core
but it joins and says it's playing things?
@glass stirrup yes
sounds like it's not subscribing
connection.subscribe(player); i got this
Could be missing the guild voice intents since ur not actually checking if the connection becomes ready
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?
https://hastebin.com/rafuqibize.typescript
this is my code
the queue part is the issue;
it will play the first song and i try to play a different song and it just stops.
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?
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
you could do something like client.player = player and then access it from a different file?
export
const music = require('../all/play');
client.player = music.player;
client.player.pause();
await message.reply('stopped!');
cannot read property pause of undefined
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
You'll have to track that yourself since djs no longer has voice components
Not true
On another note, how do I play something from a URL in v13?
You can get that with <Client>.voice.adapters.size
Thank you 
You could follow the example music-bot.
Can you send a link to the example, I can't find it
Thank you 
Is there a version not in typescript by any chance 🥺
Why is djs voice so much more difficult than it used to be, or is that just me 
I would just read the guide tbh
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 
Use the joinVoiceChannel function
discordjs.guide results:
• Library: Voice Connections
Then await entersState(connection, "ready", 30e3)
It's not working 
Is this right?
var channelId = msg.member.voice.channelID;
const connection = joinVoiceChannel({
channelId: channelId,
guildId: msg.guild.id,
adapterCreator: msg.guild.voiceAdapterCreator,
});
It’s .channelId (small d)
Oh
I swear, if that was the reason why all my code wasn't working this whole time 
Like all of it
It joined the voice channel 
So how do I make it simply play something from a url?
What kind of url?
Like just an https:// kinda thing
Is it a link to a mp3 file?
Yes
The actual URL doesn't end in .mp3, but I'm pretty sure it's still an mp3 url link thingy.
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
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 
You could use smth like node-fetch to fetch the url
I didn't have to use anything specific for the URL previously so I think it will work, just what code would I use?
I mean, this package is completely different from v12
Voice package introduces audio players and audio resource, which wasn’t a thing in v12
Well what would be the code to play from URL, just tell me that
If it is an mp3 type thingy
You need to get a stream from the url first
Then createAudioResource to make a resource from the stream
Can you give an example of the stream part
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
const res = await fetch(url)
^
ReferenceError: fetch is not defined
I used node-fetch as an example bc it comes with d.js
I don't understand
Like how do I use it if it comes with djs?
This isn't working and it kept telling me about how stream is an experimental feature.
Show code
I think it pretty useful... lacks explanations but gawd dayum is it better
Well I sure hope that it is better, but there is really no explanation for anything which is highly unhelpful.
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);
Just do const fetch = require("node-fetch")
If you installed node-fetch, make sure it’s v2
It's v3....
Then downgrade it
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 
Is there an error?
No error
does it join a channel?
Yes it does
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 
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
Can discord.js play m3u8 url stream?
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 
You didn’t subscribe the connection to the player
connection.subscribe(player)
Oh
Okay finally it works 
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?
It might be possible
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?
Yea
<Connection>.state.subscription
So do I check if that exists and then make arguments off of that?
I just tried once more
The stream variable is gud
But the player and connection
Variable is coming like this
Object_object
What to do?
// #==============================================================
// # 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?
How do I make my bot play something?
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
did you enable GUILD_VOICE_STATES intent?
ah no i didn't, you see that's why i hate that you can't just enable all of them
you shouldn't
why though?
you just have to enable what you need, not "all"
but what if i need all or just don't want to bother searching for every single intent i need
Hello, the client stops playing the music when I move it via discord from a vc to another..can I stop this?
joinVoiceChannel({
channelId: '820534941049421844',
guildId: '748914550082109541',
adapterCreator: channel.guild.voiceAdapterCreator,
});```What should I set adapterCreator?
Channel = VoiceChannel
So get guild from somewhere and run that code

So when you move your bot via discord. It will first disconnect and then connect again. So check on your disconnect logics. If you don't have any disconnect logic, then it will continue to play song
disconnect logics! Do mean other custom commands could affect this action and causing this issue?
If you can be more specific.
Disconnect logics like given in examples.
Okay I will look into that, thanks for the help much appreciated.
👍
could you show me excactly where/what to write? i tried that but it doesn't work, like if i just have no intents
had the ping off
intents: number
I still don't understand
Can you give me example or ....?
Is receiving audio supported in v13? I cannot find any documentation
how do I mkae the bot join the vc, I have the package installed but this doesn't make it join
ok, thanks
How to make join Vc in v13
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?
not a voice related question
.
The same problem I with me
And I think
The Devs here won't help us
As I am looking for solution since the v13 got released
how to pause and unpause with @discordjs/voice
how much better is sodium compared to libsodium-wrappers? i'm having problems installing sodium
just do npm i libsodium-wrappers @tall apex dw about sodium
How do I skip to a certain time in the song?
is there a good way to tell if someone in my bots vc is speaking or not??
any idea why it'd be telling me "adapterCreator is not a function"
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?
wrong version of discordjs maybe
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);```
the full code on https://github.com/konixy/nightmusic
mp me for an answer
I don't know a lot about ytdl but I think you created the player wrong.
At least for me, I would use createAudioPlayer();
Not really sure though so don't take my word for it.
ok thx i will try
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.
/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);```
playStream doesn't exist? Also, why are you putting parameters on the resource?
bruh
i'm stupid
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
ok thx a lot 🙂
Since you're making a music bot, I'd recommend following these examples: https://github.com/discordjs/voice/blob/main/examples
and what is player ?
ok thx
Just take a look at the music bot example, that should help 
fine
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.
Guide suggestion for @south lark:
discordjs.guide results:
• Library: Voice Connections
• Additional Information: Voice
there's the voice guide
I've read through that a million times. It has no information on voice receiving.
VoiceState.disconnect()
How do I get my BOT into the call using discordjs/voice, I didn't find it in the docs
Can you set the bitrate of an audio resource?
I know you could in d.js v12, with
connection.play(..., { bitrate: 128000 })```
is there a way to check if the bot is already in the voice channel?
You can check if connection exists 
ok
like this?
not like that
You can check <Guild>.me.voice.channelId
Or getVoiceConnection(<Guild>.id) if ur looking specifically for a voice connection via the package
ok
it worked
@icy maple how can I check if my bot joined a stage channel and have it automatically make itself speaker?
Is that posssible?
<Guild>.me.voice.setSuppressed(false)
So that checks if it's able to talk I assume. How do I make it make itself speaker?
Right?
Yep
Well how do I make itself speaker than?
If it just checks if it can talk or not.
That is how you make it a speaker
OOOOH, I understand now
I think the property to check if it’s a speaker is just .suppressed
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?
You should check if it’s a stage channel
Okay, I understand. Thanks 
Didn't work
if (this.channel?.type !== 'GUILD_STAGE_VOICE') throw new Error('VOICE_NOT_STAGE_CHANNEL');
^
Error [VOICE_NOT_STAGE_CHANNEL]: You are only allowed to do this in stage channels.
I had it in a stage channel.
Can you show the line?
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.
Make sure the bot has the guild voice states intent
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?
Priority Speaker
Ah
How do I skip to a certain time of a song?
Can you show me the full thing, cause what I did didn't work for the if statement.
Show code
Oh wait I may have fixed it.
The voice package doesn’t do that anymore
oh ok
Nevermind it didn't 
Normally, you would handle that when getting the stream
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)
Or you have to download the entire stream then seek
Neither of these worked.
It’s .suppress
Oh
So like this?
if (msg.guild.me.voice.supress) msg.guild.me.voice.setSuppressed(false)
Yes
That didn't work 
No error, just flat out didn't run the code.
Can you log the condition then?
It logs as undefined.
Hold up, I see the paramater
When I log voice on its own, I see the parameter is set as false, but it doesn't actually let me do .supress or hwatever
Oh, I misspelled it
suppress
I misspelled it as well when I typed it out in my own code 
It's fixed now 
That’s why I use js docs or ts, lol
This doesn't seem to be true 
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 
Time to binary search for the correct permission
Unless it’s in the api docs
It’s mute members apparently
Yeah, I just figured that out. That's super weird, why that out of all permissions 
Move members makes more sense, why mute members 
I guess ppl who want to speak and be heard can mute everyone else? ¯_(ツ)_/¯
in depth guide on looping?
Just make a Queue structure
How can I use lavalink
not djs-voice related
How do i connect to a voice channel? / Make the bot join a vc
what's this error, it's only happens sometimes when listening to songs 
This is error from ytdl-core, not djs-voice related
really? it's logged from player.on("error")
https://github.com/fent/node-ytdl-core/issues/902
I know, ytdl-core creates a resource and throws a error and this is passed to audioPlayer
thanks :)
how come when I change the volume while audio is playing it so much lower than when it starts
code please
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);
What is playQueue.volume initially ??
it loads it from database
BTW you can do this also connection.state.subscription.player.state.resource.volume.setVolume(cv)
No need for _state
Tell me some value of it.
but I put for example 100 and it sounds like it sets at 50
That volume is in decimals
Like
0 = 0%
1 = 100%
0.5 = 50%
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
Oh okay, Let me test that .
🙏
I'm not crazy right? Like it does it for you too also?
It changes back to normal for me.
weird
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
ffmpeg stream got closed nothing else.
Not a djs-voice issue
On this note I am going to bed since its 2am. The problem was that I was doing args[0] / 100 x2. Once while saving into the database then again while setting the volume lol
LOL
why ..it is supposed to stay open so that when i speak it hears what i am speaking
If it is a audioReciever, then see examples and see where are you wrong .
I have not tested this feature since release, so can't say anything
https://github.com/discordjs/voice/tree/main/examples/recorder
Cannot destroy VoiceConnection - it has already been destroyed
What's wrong with me getting this error?
It means that you are trying to destroy a connection, that is already destroyed
how to play youtube live stream in @discordjs/voice?
How can i list the active voice connections of a bot? in djs v13
const connections = getVoiceConnections() ig
with play-dl you can play live streams
Is it normal that installing sodium takes a long time on ubuntu?
hello
how can I seek an audio?
const resource = createAudioResource('./audio.mp3');
player.play(resource);
I looked into that code trying to extract any info, the thing is I'm using Erela.js Library not the native discord.js library which might make it kinda complicated at least for me..but I tried to extract info from it it seems that he is trying to get the state of the client and acting upon it, if I wasn't right hope you correct me, thank!
If you use a different discord library, so why are you asking this question here ??
Ask their developers
Seemed that people were asking about in here so I did the same, anyway appreciated tho!
No, don't ask their library questions here.
Ye got it
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
Is there any way a single bot can play in multiple channels of same server? Someone told me that's possible with @discordjs/voice
WTF, who told you ??
Can i get a link to the guide for voice?
How I can let a bot leave the voice channel with guild id?
const { getVoiceConnection } = require('@discordjs/voice');
const connection = getVoiceConnection(guild.id);
connection.destroy();
ok thx
Read these lines carefully.
the pull request description states that it resolves this issue https://github.com/discordjs/voice/issues/144
Read these lines
yes, one bot cannot join multiple channels of the same server I know that.
if they wish to run more than one bot in the process.
how can i see if a user is in a voice channel with interactions
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
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");
djs v13 has nothing to do with voice. It is @discordjs/voice now
console.log('Ready!');
const connection = joinVoiceChannel({
channelId: '820534941049421844',
guildId: '748914550082109541',
adapterCreator: ... .voiceAdapterCreator,
});
});```What should I set adapterCreator?
i know but i don't know how to play with a url
some on hhhhhhhhhhhelp i'm on this ---- for 2 day
@green marsh
it's not massage ....
i don't see the "ready"
hmmmm. bruh
const { joinVoiceChannel } = require('@discordjs/voice');
const connection = joinVoiceChannel({
channelId: channel.id,
guildId: channel.guild.id,
adapterCreator: channel.guild.voiceAdapterCreator,
});```
😐 i know it but what in ready
it's don't have channel.guild 
so as soon as the bot starts you want it in a voice chat?
sure just connect and afk in voice
pong! 
whats your code look like
?
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?
code?
Wdym
whats your code
If you meant what language then it’s discord.js, idk what code you’re talking about.
post...your....code....
What code bro
I have plenty of codes