#archive-voice

30636 messages · Page 31 of 31 (latest)

waxen wedge

console.log(opusStream) then and take a look at that… if that‘s not the issue then look at your node version, because the events would be emitted from the Readable parent class, which is part of node:stream

eager lake

It does log ended: true, but endEmitted is still false

waxen wedge
waxen wedge
sterile spire

I have a music discord bot. It can play youtube music using ytdl-core and radio stream with basic stream url. But whenever I try to listen radio stream after playing a youtube music, it doesn't work. My bot stop playing youtube music but doesn't play radio stream. I don't get any error message. I am using player.play(<radio_stream_source>) method in order to change resource. Do you have any idea why this is not working ?

waxen wedge
sterile spire

as Audio Resource. Actually, I am adding youtube music feature to my bot. I finished the radio part and it works. It just happens when i try to listen radio after playing some youtube music.

fiery blade

I think I saw something related in github issues

waxen wedge

Yes, and the workaround for that was to not use URLs directly but pass them into a createAudioResource() and then pass that to the player

sterile spire

i can share my code if you want ?

Firstly, i thought destroying audioResource object is not enough and i should destroy ytdl-core's readable stream and i destroyed it but it doesn't change anything.

sterile spire

Any idea ?

cursive sapphire
(node:9896) Warning: [DiscordPlayerWarning] Unhandled "connectionError" event! Events "error", "connectionError" must have event listeners!```I got this error when i use `discord-player` dependency, while the bot is playing the song, suddenly in the middle it abruptly stopped and left the voice channel, is it related to djs or the audio dependencies i use like `ffmpeg-static` and `discord-player`, inlcuding `@discordjs/opus` and `@discordjs/voice`?
loud dome
    if (resource.ended) {```

what does this mean

cursive sapphire
waxen wedge

bro what causes the error, djs or third-party dependency?

waxen wedge
toxic minnow
loud dome
subtle granite

How can i make my bot to record voice from vc?

waxen wedge
regal fulcrum

not like they even went here to check but good one

sterile spire

I have a music discord bot. It can play youtube music using ytdl-core and radio stream with basic stream url. But whenever I try to listen radio stream after playing a youtube music, it doesn't work. My bot stop playing youtube music but doesn't play radio stream. I don't get any error message. I am using player.play(<radio_stream_source>) method in order to change resource. Do you have any idea why this is not working ?

fiery blade

If it doesn't work with passing the radio url into createAudioResource, no, no idea

frozen anvil

Do bots automatically leave voice channels after certain time of inactivity?

quartz marsh

Hello, does someone know how can I send the listening stream to Google Speech API?

seems like it's not the right format using the following code:

module.exports.attachStream = (stream) => {
        const audio = connection.receiver.subscribe('422820341791064085', {
            end: {
                behavior: EndBehaviorType.Manual
            }
        });
        audio.pipe(stream);
        return audio;
    }

stream is the Google Speech API stream (I need to send the audio stream there)

edgy grail

I got this error

quartz marsh

issue fixed, instead of using a stream I used requests one by one to speech

final jay

does anyone know how can I seek using ffmpeg?

fiery blade
final jay

one question tho

I pipe the current playing stream to this ffmpeg

right? like so...

@fiery blade

fiery blade

try it and see

final jay
fiery blade

is it in ms

final jay

still, I input like 10, it goes to half of the song

if I try seeking again to 0 (beginning of the song), it goes to the end, and the song ends

fiery blade

probably because of the pipe

final jay

I do think the stream I need is the one on ffmpegProcess.stdio[4] but

when I try playing that it doesn't play anything

rose helm

btw, If you're not listening to stderr, select ignore instead of pipe

final jay

@rose helm dude

how do I play pipe:4 on the bot?

when I put song.mp3 instead of pipe:4, it gives me exactly what I want to play, but as a mp3 file

I want to play pipe:4 on the music bot, but I can't put that in a audio resource and make it play

rose helm

why do you want to use pipe:4 when it doesn't exist? I just told you what each pipe is and documentation to prove it. Why would you intentionally want to divert from developer standards?

rose helm

"-i", "pipe:0"

"pipe:1"

final jay

my dude

what is the difference in the numbers
I am 100% sure changing the numbers won't make it work

rose helm

read the node documentation

final jay

I did

rose helm

and do you understand the concept of stdin and stdout

final jay

no

rose helm

stdin is the pipe you input data into a child process
stdout is the pipe the child process outputs data after its done processing the input or whatever

and of course stderr is the pipe it will log errors to

As I said earlier, stdin is 0, stdout is 1 and stderr is 2

final jay

you're saying is I need stdout[4] instead of stdio[4]?

I tried that already, didn't work, stdout is undefined

languid quail

monbreyFacepalm

rose helm

no. Ignore the 4. 4 doesn't exist. stdout automatically links to the ReadableStream that is the child process' output assuming you properly configured the pipes, which you didn't

final jay

WAIT

rose helm

idk why you're so fixated on 4

final jay

it is what comes after 3

rose helm

Okay. What's so special about 3

final jay

so this?

now I would need to create a new audio resource with ffmpegProcess.stdout[1]?

rose helm

0 is input for on error, so use 2

output is 1

final jay

uh, so this?

rose helm

No, you'd pipe to 0 at the bottom. That you had proper. You would create a resource from 1

final jay

hmmm, and the rest keep 2?

rose helm

oh also at the top to input, change to 0

final jay

hmmm I see

and then I create a new audio resource from ffmpegProcess.std__out__[1]?

rose helm

You don't need the index accessor on stdout since it isn't an Array. stdout is already a ReadableStream

final jay

oh, so that is why it gave me undefined when I tried stdout, interesting

ye, now it gives me errors for stuff that aren't even on my code

rose helm

Then google will be your friend

south lark

I need help scaling a bot with @discordjs/voice, like literally it gets so laggy and I have no idea what to do shrug

toxic minnow

shard & use hosting software

subtle granite

How can I make my Discord bot join a voice channel and stay there 24/7 doing nothing?

fiery blade

Literally just a waste of bandwidth

subtle granite

for no reason at all

final jay

is there a way to edit the current playing resource stream, without having to create a new resource?

fiery blade

theoretically yes but no recommended way

next nacelle

when a bot plays music in a voice channel, what's the default bitrate?

loud dome
    if (resource.ended) {
                 ^

TypeError: Cannot read properties of undefined (reading 'ended')
    at AudioPlayer.play (/home/dumitru/Desktop/cringe-main/node_modules/@discordjs/voice/dist/index.js:944:18)
    at Object.<anonymous> (/home/dumitru/Desktop/cringe-main/main.js:12:8)
    at Module._compile (node:internal/modules/cjs/loader:1099:14)
    at Object.Module._extensions..js (node:internal/modules/cjs/loader:1153:10)
    at Module.load (node:internal/modules/cjs/loader:975:32)
    at Function.Module._load (node:internal/modules/cjs/loader:822:12)
    at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:77:12)
    at node:internal/main/run_main_module:17:47

Node.js v17.9.0```
waxen wedge
waxen wedge
loud dome
waxen wedge Show main.js line 12 (and probably the lines before that)
const Discord = require("discord.js");
const TOKEN = "sus";
const { createAudioPlayer , getVoiceConnection } = require('@discordjs/voice');
const client = new Discord.Client({
    intents: [
        "GUILDS",
        "GUILD_MESSAGES"
    ]
});
const connection = getVoiceConnection(987282287714533410);
const player = createAudioPlayer('/home/dumitru/Desktop/cringe-main/the_perfect_girl_-_mareux_slowed.mp3');
player.play();
connection.destroy();
client.login(TOKEN).then(() => {
    client.user.setPresence({ activities: [{ name: "Minecraft", type: "PLAYING" }], status: "online" })
});
waxen wedge
dusty needleBOT

Suggestion for @loud dome:
guide Library: Audio Player
read more

waxen wedge
loud dome

oh makes sense

do i need to provide any guild id to the VoiceConnection?

@waxen wedge

/home/dumitru/Desktop/cringe-main/node_modules/prism-media/src/core/FFmpeg.js:143
    throw new Error('FFmpeg/avconv not found!');
    ^

Error: FFmpeg/avconv not found!
    at Function.getInfo (/home/dumitru/Desktop/cringe-main/node_modules/prism-media/src/core/FFmpeg.js:143:11)
    at Function.create (/home/dumitru/Desktop/cringe-main/node_modules/prism-media/src/core/FFmpeg.js:156:38)
    at new FFmpeg (/home/dumitru/Desktop/cringe-main/node_modules/prism-media/src/core/FFmpeg.js:45:27)
    at Object.transformer (/home/dumitru/Desktop/cringe-main/node_modules/@discordjs/voice/dist/index.js:1780:27)
    at /home/dumitru/Desktop/cringe-main/node_modules/@discordjs/voice/dist/index.js:1936:58
    at Array.map (<anonymous>)
    at createAudioResource (/home/dumitru/Desktop/cringe-main/node_modules/@discordjs/voice/dist/index.js:1936:39)
    at Object.<anonymous> (/home/dumitru/Desktop/cringe-main/main.js:16:16)
    at Module._compile (node:internal/modules/cjs/loader:1099:14)
    at Object.Module._extensions..js (node:internal/modules/cjs/loader:1153:10)

Node.js v17.9.0```
const Discord = require("discord.js");
const TOKEN = "sus";
const { createAudioPlayer , createAudioResource ,getVoiceConnection , NoSubscriberBehavior } = require('@discordjs/voice');
const client = new Discord.Client({
    intents: [
        "GUILDS",
        "GUILD_MESSAGES"
    ]
});
const connection = getVoiceConnection("987282287714533410");
const player = createAudioPlayer({
    behaviors: {
        noSubscriber: NoSubscriberBehavior.Pause,
    },
});
const source = createAudioResource('~/Desktop/cringe-main/the_perfect_girl_-_mareux_slowed.mp3');
player.play(source);
connection.destroy();
client.login(TOKEN).then(() => {
    client.user.setPresence({ activities: [{ name: "Minecraft", type: "PLAYING" }], status: "online" })
});

nvm i solved it

const Discord = require("discord.js");
const TOKEN = "sus";
const { createAudioPlayer , createAudioResource ,getVoiceConnection , NoSubscriberBehavior } = require('@discordjs/voice');
const client = new Discord.Client({
    intents: [
        "GUILDS",
        "GUILD_MESSAGES"
    ]
});
client.on("ready", () => {
    console.log(`Logged in as ${client.user.tag}`)

});
const connection = getVoiceConnection("987282287714533410");
const player = createAudioPlayer({
    behaviors: {
        noSubscriber: NoSubscriberBehavior.Pause,
    },
});
const source = createAudioResource('~/Desktop/cringe-main/the_perfect_girl_-_mareux_slowed.mp3');
player.play(source);
client.login(TOKEN).then(() => {
    client.user.setPresence({ activities: [{ name: "Minecraft", type: "PLAYING" }], status: "online" })
});
``` Made a few changes though couldn't make the bot join the VC, perhaps I didn't specify anywhere the guild id
waxen wedge
loud dome
waxen wedge
loud dome
next nacelle
brave blaze

Heyo,
how to get the player state?

finite grotto
brave blaze

Thanks

frozen anvil

Do bots automatically leave voice channels after certain time of inactivity? If so, is there an event to detect when they do?

finite grotto
waxen wedge
sterile spire

In audioResource, is there a way in order to change highwatermark and what is default hightwatermark value ?

toxic minnow

What does “Did not find the EBML tag at the start of the stream” mean?

fiery blade

subscribe to them, get the opus stream, probably need to transform into a stream that a stt api accepts, put in stt api, get text

waxen wedge

And respect the privacy of users when doing that, so sending their voice to a stt api might not be legal…

Write up a Privacy Policy and link it in your bot, so the users agree to it before using it?

loud dome

So I managed to get through all the errors that happened to appear, but still couldn't manage to get the bot into the voice chat

Actually nvm it joined the vc but didn't play anything

loud dome

if the bot is on deafen, can it prevent from playing audio?

next nacelle

does changing the bitrate of a voice channel affect the bitrate of an AudioResource

nocturne igloo

hi

so basically I am trying to run different discord.js music bots but on the same process

like this:```js
tokens.forEach(token => {
const client = new Client({ intents: ["GUILDS", "GUILD_MESSAGES", "GUILD_VOICE_STATES", "GUILD_MESSAGE_REACTIONS"] });
const player = new Player(client);

// music code

client.login(token);
});

the issue I am having is that joinVoiceChannel method only allows 1 client to be in a voice channel

stoic sequoia

I don't see intents

nocturne igloo

oh that's just an example...

stoic sequoia

that should work ig

nocturne igloo

only 1 client joins the voice channel for some reason

also I tried this simple code inside ```js
client.on("ready", () => {
const guild = client.guilds.cache.get(client.subscription.server);
if (!guild) return;
joinVoiceChannel({
guildId: guild.id,
channelId: "994198851982458890",
adapterCreator: guild.voiceAdapterCreator,
selfDeaf: true
});
});

and only 1 bot joins the voice channel

anyone got any idea why?

willow otter

heya!

can i volume up the sound?

waxen wedge

If you set inlineVolume to true you can by setVolume

willow otter

cool ty

hmm weird it reads short words but not long sentence

willow otter

ohh it because of the file size?

found this on stackoverflow

eager lake

I can easily play files with several megabytes, so shouldnt be a problem

willow otter

now im looking for a way to compress wav or convert it to mp3

willow otter

do you know how to use @ discordjs/opus

icy maple

And before you ping me, no, I don’t know how to use /opus directly

willow otter

ok :) thank yoi

shut zenith
if (AudioPlayerStatus.Playing)
``` ```js
if (AudioPlayerStatus === Playing)
```Which is correct to check if the audio is playing?
waxen wedge

With player being an AudioPlayer instance

shut zenith

How do I then get the voice channel the bot is in?

waxen wedge

<Guild>.me.voice.channel

fervent warren

I'm grabbing audio in electron via getUserMedia and then using that as the audio for the bot, but it's completely corrupted and there is extremely loud static with the audio 😦

that's the code I'm using and this is what the audio sounds like

what am I doing wrong :/

pine mulch

whats audio resource volume range? (with inlineVolume true ofc)

foggy terrace
pine mulch
foggy terrace
waxen wedge
pine mulch
golden path

how can I change the audio source from one file to another while a connection is made with a voice channel

finite grotto
golden path
golden path

got it, thanks

so I'm using this

let resource = createAudioResource("cool/file/path", {
  inlineVolume: true
});
let player = createAudioPlayer()
player.play(resource);

but I can't get the new audio to play

finite grotto

is the voice connection subscribed to the new audio player?

golden path

oh 🤦‍♂️

if I'm staying in the same vc, do I just use this:

const connection = getVoiceConnection(interaction.guild.id)
connection.subscribe(player);

before I play from the player

finite grotto

sure

golden path

that worked. thank you so much

waxen wedge

Or just keep the player and call play on it with the new resources

golden path

how come getVoiceConnection works inconsistently - it sometimes requires both a guild and user id to function and other times it won't function when given a user id

finite grotto
golden path

I was told to add it as a parameter and it has been working fine but now I'm trying to disconnect the player when not using Distube and am now running into the same problem

finite grotto
golden path

ended up just using a try and catch lol

try {
  let connection = getVoiceConnection(interaction.guild.id)
  connection.destroy();
  await radioSchema.findOneAndDelete({ GuildID: interaction.guild.id })
} catch (e) {
  let connection = getVoiceConnection(interaction.guild.id, client.user.id)
  connection.destroy();
}
shadow lava

voice.getVoiceConnection(`guild_id`).disconnect();

does this still works in djs 13?

finite grotto
dusty needleBOT
shadow lava

mmmmmm

first ihave to import @discordjs/voice then

finite grotto

you should probably also read the voice guide intro

dusty needleBOT

Suggestion for @shadow lava:
guide Getting Started: Introduction
read more

shadow lava

yes reading that only

shadow lava

Could not join the channel: TypeError: channel.join is not a function

waxen wedge
willow otter

what file type can discord.js play

waxen wedge
willow otter what file type can discord.js play

discord.js itself: none; djs-voice sends Opus packets to discord. But it also uses ffmpeg to transcode virtually anything into Opus. So I guess the answer to your intended question is: anything ffmpeg can

rose pond

Question..
Discord dont have a package for music that works with lavalink?

waxen wedge

Discord don’t have any npm packages, no

subtle granite

How to remove all slash commands of my bot from all servers ?

waxen wedge
subtle granite
waxen wedge
subtle granite How?

Same way you deployed them in the first place. But instead of passing an array with all your commands in it pass []

abstract reef

i am trying to make a bot that plays a certain song when a user joins the call now the bot joins the call successfully but the music for some reason doesnt play i have installed sodium and ffmpeg

i have been told to go here

nvm i fixed it

echo sorrel

Is there a way to make the bot leave when it finishes playing mp3?

rose helm
willow otter

assuming you're good at these kind of things

waxen wedge
willow otter
fiery blade

you don't need to use a function from opus, but voice uses it for codec

dusky patio

I tried to solve it, everything seems to be in vain, can anyone suggest me the method to fix it.

dusty needleBOT

AbortError: The user aborted a request.
A request took longer than the specified restRequestTimeout (15 seconds default), and was aborted to not lock up the request handler.
• This can be caused by an internal server error on Discord's side, or just a slow connection.
• In case of a slow connection, the restRequestTimeout option in ClientOptions can be increased to prevent future AbortErrors.

rose helm
fiery blade

if you wrote a better function why not pr it

rose helm

If you don't use typescript, you'll have to remove the typescript decorators

Because they want to use node internal modules which is the issue

dusky patio

oh thanks you

subtle granite

how do i get member voice channel id if the member is on vc? in discordjs/voice

fiery blade

member.voice.channel

subtle granite
fiery blade

if you need to use the id sure

subtle granite

aight

golden path
subtle granite

how can i fix this?

golden path

I'm trying to determine when a user has left a channel but I's getting an error saying the connection is undefined

client.on("voiceStateUpdate", async function(oldState, newState){
    const connection = getVoiceConnection(newState.member.guild.id, newState.member.id);
    if (VoiceConnectionStatus.Disconnected === connection.status) {
        [random code]
    }
});
rose helm

Your client may not be connected

waxen wedge
waxen wedge
fervent estuary
subtle granite

how can i fix this?

dusty needleBOT

Tag suggestion for @subtle granite:
ReferenceError: "x" is not defined: learn more
TypeError: Cannot read properties of undefined/null (reading "x"): learn more

dusty needleBOT

Error [DISALLOWED_INTENTS]: Privileged intent provided is not enabled or whitelisted.

If you are using the GUILD_MEMBERS, GUILD_PRESENCES, or MESSAGE_CONTENT intents, you need to enable them in the developer portal:
Developer Portal > Your app > Bot > Privileged Gateway Intents

sweet wigeon

How do I seek in a song? it seems that most v13 bots either use lavalink or dont implement a seek command.

sweet wigeon

what format is best?
opus?
pcm?

rose helm

the output needs to be opus. Anything imported into ffmpeg will be converted to ffmpeg pcm and then back to the output

final jay

why is this happening, out of no where, everything was working fine, I restarted the bot and now this

waxen wedge
final jay

but, did discord.js/voice always require ffmpeg?

waxen wedge

Or your host just updated/uninstalled ffmpeg

final jay

I never had ffmpeg installed

but I guess that is because the lib I use always give opus encoded streams

waxen wedge

Yup, opus doesn’t need ffmpeg. PCM or other would

final jay

@waxen wedge I have a weird problem dude, idk if you can help me

but even after installing ffmpeg, in many different ways, it still not working

with ffmpeg installed, it doesn't give the error, but still doesn't play anything

and the exact same code runs fine on my pc (without ffmpeg installed)

but on the vps, it doesn't work, even with or without ffmpeg

really don't know what to do

subtle granite

hey can I ask a question?

can you play song from external links?

links that end with .mp3

hazy remnant

Yeah

final jay

which file formats can it play (from a link), I know ogg and mp3 works, what else does?

also, how do I check if a link is a playable media file

waxen wedge
gray bolt

Is there a common way to seek AudioResources in discord.js v13? I tried fluent-ffmpeg but that is way to slow.
I do want to pause the current track, play something else, and then resume playback of the current track

waxen wedge
gray bolt
waxen wedge
gray bolt

Guess it is lavalink then. Tho this does increase complexity of my bot more than exponentially compared to the previous version.

gray bolt

@waxen wedge You maybe know what is the best lavalink client to use?

gray bolt
rose helm

Without piping through ffmpeg is currently impossible unless you did it with another language and somehow interfaced with that

A node addon could be created, but they're usually painful

lavish ice

How do i check if audio is already playing before i pause

rose helm

I've been devoting a lot of my development and research time to looking for native audio transforming

lavish ice
rose helm
gray bolt

Now integrated lavalink but it is equally slow when resumeing/seeking :/ All i want is to play TTS inbetween

chrome raptor

Hi,
I want to play a .opus audio file but I always get the following error:
capture_pattern is not OggS

Code: ```js
import { createReadStream } from 'fs';
import { createAudioPlayer, createAudioResource, joinVoiceChannel, StreamType } from '@discordjs/voice';

export async function play(interaction)
{
const channelId = interaction.member.voice.channelId;

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

let player = createAudioPlayer();

player.on('error', error =>
{
    console.log('AudioPlayer threw an error!');
    console.log(`Name: ${error.name}\nResource: ${error.resource}\nMessage: ${error.message}\nError: ${error}`);
});
    
connection.subscribe(player);


const resource = createAudioResource(createReadStream('music.opus'), { inputType: StreamType.OggOpus });

player.play(resource);

}

I can't find anything on how to fix this.
fiery blade
chrome raptor

.opus

fiery blade

have you tried setting inputtype to streamtype.opus then

loud dome

is it possible to indicate as a audio source a url? if so, how?

chrome raptor
fiery blade

If it's a radio you'd need to set it to raw inputtype iirc

loud dome
chrome raptor

He's referring to the path of the audio file with url

loud dome
fiery blade
loud dome
fiery blade

passing a url for a youtube video won't work, there might be an npm package for getting the audio but I doubt that should be explicitly supported here because scraping youtube apis is against discord tos

chrome raptor

It works! Thanks

Is there any advantage in using Streamtype?

fiery blade

so that the decoder knows what codec it is

loud dome
fiery blade
chrome raptor

I tested it with other types and now it works with every stream type
WHY?

loud dome
fiery blade
chrome raptor
fiery blade what

Ah no I just forgot some brackets and it worked with everything magically
I love javascript

It's WebmOpus now for some reason. It used to work with OggOpus.

loud dome
toxic minnow
jolly zenith

Is opus v0.5.3 not available for ubuntu?

static tulip

Hi, how can i remove player? I destroyed the connection but i still see ffmpeg process in htop

waxen wedge
waxen wedge
static tulip

yes

waxen wedge

Are you certain that is the only player / resource active in your bot?

static tulip

yes

proud otter

my working bot today suddenly shutdown i download my file to replit and run and show this error i download ffmpeg-static not work

waxen wedge
fervent estuary

it never actually terminates the process

i had the same issue

static tulip
fervent estuary

you can kill it by executing a terminal cmd within ur code

dont remember exactly how it was done but i remember that it worked for me

static tulip

Oh god

south lark

Hey there, I need some help. I'm getting some weird errors.

 RangeError [ERR_OUT_OF_RANGE]: The value of "offset" is out of range. It must be >= 0 and <= 10. Received 11
     at new NodeError (node:internal/errors:371:5)
     at boundsError (node:internal/buffer:86:9)
     at Buffer.readUInt8 (node:internal/buffer:252:5)
     at VoiceReceiver.parsePacket (/home/dzlandis/Discord-Scriptly-Free/node_modules/@discordjs/voice/dist/index.js:1303:27)
     at VoiceReceiver.onUdpMessage (/home/dzlandis/Discord-Scriptly-Free/node_modules/@discordjs/voice/dist/index.js:1322:27)
     at VoiceUDPSocket.emit (node:events:390:28)
     at VoiceUDPSocket.onMessage (/home/dzlandis/Discord-Scriptly-Free/node_modules/@discordjs/voice/dist/index.js:311:10)
     at Socket.<anonymous> (/home/dzlandis/Discord-Scriptly-Free/node_modules/@discordjs/voice/dist/index.js:293:48)
     at Socket.emit (node:events:390:28)
     at UDP.onMessage [as onmessage] (node:dgram:931:8) {
   code: 'ERR_OUT_OF_RANGE'
 }

and this next error causes the bot to restart and crash:

16:08:42: FATAL ERROR: Error::ThrowAsJavaScriptException napi_throw
16:08:42:  1: 0xb02ec0 node::Abort() [node /home/dzlandis/Discord-Scriptly-Free/index.js]
16:08:42:  2: 0xa181fb node::FatalError(char const*, char const*) [node /home/dzlandis/Discord-Scriptly-Free/index.js]
16:08:42:  3: 0xa18204  [node /home/dzlandis/Discord-Scriptly-Free/index.js]
16:08:42:  4: 0xaca77b napi_fatal_error [node /home/dzlandis/Discord-Scriptly-Free/index.js]
16:08:42:  5: 0x7f25fc472c9e  [/home/dzlandis/Discord-Scriptly-Free/node_modules/@discordjs/opus/prebuild/node-v93-napi-v3-linux-x64-glibc-2.31/opus.node]
16:08:42:  6: 0x7f25fc4733fc Napi::Error::ThrowAsJavaScriptException() const [/home/dzlandis/Discord-Scriptly-Free/node_modules/@discordjs/opus/prebuild/node-v93-napi-v3-linux-x64-glibc-2.31/opus.node]
16:08:42:  7: 0x7f25fc47fdeb OpusEncoder::Decode(Napi::CallbackInfo const&) [/home/dzlandis/Discord-Scriptly-Free/node_modules/@discordjs/opus/prebuild/node-v93-napi-v3-linux-x64-glibc-2.31/opus.node]
16:08:42:  8: 0x7f25fc476aba Napi::InstanceWrap<OpusEncoder>::InstanceMethodCallbackWrapper(napi_env__*, napi_callback_info__*) [/home/dzlandis/Discord-Scriptly-Free/node_modules/@discordjs/opus/prebuild/node-v93-napi-v3-linux-x64-glibc-2.31/opus.node]
16:08:42:  9: 0xaadf9d  [node /home/dzlandis/Discord-Scriptly-Free/index.js]
16:08:42: 10: 0xd4a18e  [node /home/dzlandis/Discord-Scriptly-Free/index.js]
16:08:42: 11: 0xd4b5af v8::internal::Builtin_HandleApiCall(int, unsigned long*, v8::internal::Isolate*) [node /home/dzlandis/Discord-Scriptly-Free/index.js]
16:08:42: 12: 0x15e7959  [node /home/dzlandis/Discord-Scriptly-Free/index.js]

Any help is greatly appreciated 🙏

south lark
stoic thunder

What could cause an AudioPlayer to abort while playing? Also wondering how could I handle AudioPlayer errors if I have a queue array that has json of per sever audioplayers?

bold tinsel
const {
    SlashCommandBuilder
} = require('@discordjs/builders');

const { getVoiceConnection } = require('@discordjs/voice');

module.exports = {
    async getConnection(client, interaction, cache) {
        let connection = getVoiceConnection(interaction.guild.id);
        console.log(connection)
        return connection;
    }
    
}

❓ The var, "connection" is undefined, tell me if you want more info.
How would I get the current connection? -- I do not have opus installed if that changes anything -- it results in an error when I try to install it :/
_ _

        if ( !connection ) {
            const connection = await connectionF.getConnection(client, interaction, cache);
            console.log("New connection is " + connection);
            serverQueue.connection = connection;
            cache.set(interaction.guild.id, serverQueue);
        }
red rover
static tulip Oh god

you could kill it like this

const { exec } = require("child_process");

exec("killall ffmpeg", (err) => {
  if(err) console.error(err);
}); 
red rover

didn't you want it to kill ffmpeg when it was done

waxen wedge
dusty needleBOT
tepid yacht

Hi! When I'm execute this command, my bot don't join my vocal. Why?
Code: ```js
const { MessageEmbed, Interaction } = require('discord.js');
const { generateDependencyReport, AudioPlayerStatus, createAudioPlayer, createAudioResource } = require('@discordjs/voice');
const { joinVoiceChannel } = require('@discordjs/voice');
const config = require('../config.json');

module.exports = {
run: async (client, message, args) => {
//get the voice channel id
const voiceChannelId = config.musicChannelId;
const voiceChannel = client.channels.cache.get(voiceChannelId);
const guildId = config.guildId;
const player = createAudioPlayer();

    player.on(AudioPlayerStatus.Playing, () => {
        console.log('The audio player has started');
    });

    player.on('error', error => {
        console.log('error');
    });

    const resource = createAudioResource('C:\\Users\\pierr\\Desktop\\Bot music\\music\\test.mp3');
    player.play(resource);

    const channel = client.channels.cache.get(message.member.voice.channel.id);


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

    message.reply("created voice connection");

    const subscription = connection.subscribe(player);

    if (subscription) {
        setTimeout(() => subscription.unsubscribe(), 15_000); 
    }

},
name: 'p',
aliases: ['p'],
desciption: "p"

}

Terminal: ```
[nodemon] starting node index.js
Musicbot#1511 est opérationnel !
Tue Jul 12 2022 09:44:41 GMT+0200 (Central European Summer Time)
The audio player has started

waxen wedge
tepid yacht

How do I enter the ID? with ' ' or " "?

tepid yacht
waxen wedge
toxic minnow

is there a way to get the AudioResource an AudioPlayer is currently playing

dusty needleBOT
waxen wedge

The Playing state has a resource property

tepid yacht

can you send me an example?

bold tinsel

Is tehre a way to fix this?

slender sparrow

existing connections gone after restart, its not persistent

waxen wedge
tepid yacht
waxen wedge
tepid yacht ?

An id is always a String in djs. So I don’t understand your question

tepid yacht

ok

bold tinsel
waxen wedge
tall rain

What im basically doing is recording the users in voice chat, so yeah.
Code: https://pastecord.com/apihazopip

The probelm:
bot recording for some time, when I went silent the bot stops the record automatically

icy maple
tall rain
icy maple

EndBehavior is the type

green vigil

What module do I need for NodeJS audio server to run on a linux server

I have Discord Voice, Ffmpeg, Opus, Lib

icy maple
icy maple

You need all core deps and one from each of the following categories listed

green vigil

Where can I find the guide

icy maple

in the topic

green vigil
green vigil
icy maple Yes

every single one of those are installed but it still yet to work on a linux server host

green vigil
} else if 
(commandName === 'orlando') {

  interaction.channel.send('Joined Voice Channel')
  const connection = joinVoiceChannel({
  channelId: interaction.member.voice.channel.id,
  guildId: interaction.guild.id,
  adapterCreator: interaction.guild.voiceAdapterCreator
})
let resource = createAudioResource(("https://live.amperwave.net/manifest/audacy-womxfmaac-hlsc.m3u8?source=aud-webplayer&ifa=cookie:66d07c4a-cfbc-482d-812f-8ffb175f0fbf"), { inlineVolume: true })
resource.volume.setVolume(1)

connection.subscribe(player);
player.play(resource);
interaction.channel.send("Now Playing: **Orlando Radio**")
console.log("Playing, Orlando Radio");

Nope

icy maple

Does the bot join the vc?

green vigil

Yes, just doesn't play audio

icy maple

Can you use add the player.stateChange event to see if the player is actually changing states?

Just log the old and new state.status

green vigil

So just replace the console.log() with console.log.player.stateChange

Not like that but you know what I mean

icy maple

Listen to the stateChange event on player

green vigil
icy maple

I’m on my phone too

green vigil
icy maple
green vigil

I know that

plucky basin

Whenever I try to run my player.play(resource) I always get this error. Whats happening?

icy maple

What’s the resource?

green vigil

player.addListener("stateChange", (oldOne, newOne) => {
  if (newOne.status == "idle") {
      console.log("The song finished");
  }
});

Didn't do anything to help

icy maple

I want you to log the old and new state.status

No conditions

The should be placed right below where the player is created

green vigil

so

player.addListener("stateChange", (oldOne, newOne) => {
      console.log(oldone,newOne);
  }
});
icy maple

Add .status for both

green vigil

oldone.status?

icy maple

Yes

green vigil

} else if 
(commandName === 'lovesongs') {
  interaction.channel.send('Joined Voice Channel')
  const connection = joinVoiceChannel({
  channelId: interaction.member.voice.channel.id,
  guildId: interaction.guild.id,
  adapterCreator: interaction.guild.voiceAdapterCreator



})
let resource = createAudioResource(("https://audio.jukehost.co.uk/QYWK7vTfem5yKxM63wG49oZtAetUZ50x"), { inlineVolume: true })
resource.volume.setVolume(1)

connection.subscribe(player);
player.play(resource);
interaction.channel.send("Now Playing: **Love Songs**")
console.log("Playing, Love Songs");
    

player.addListener("stateChange", (oldOne, newOne) => {
      console.log(oldOne.status,newOne.status);
});


Didn't log anything

plucky basin
icy maple
icy maple
plucky basin

its in the same area where my index.js is

icy maple

Is it in the same directory as the package.json file?

plucky basin

yep

icy maple

Then use ./

plucky basin

bruh why it be like that
thanks tho

green vigil

buffering
playing
playing
idle

icy maple

Idk if createAudioResource supports url as stream

green vigil

It works fine using Visual Studio but not a Linux Hosting Server how

fiery blade
green vigil

I did something and it worked but I can't remember

icy maple

Idk how else to debug it w/o getting the stream manually

Can you run node -p "require('@discordjs/voice').generateDependencyReport()"?

On ur linux machine

green vigil

Gotta ask them how don't know how the company set it up

icy maple
fiery blade should work

I’m more concerned abt how audio resource and player handles errors. Ik an invalid file path is silently ignored when played

fiery blade

heh, maybe that should get pr'd

icy maple

Maybe it’s in debug event? I’ve never tried it

fiery blade

oh right, each player/resource extends event emitter iirc

  • and has an option for debug:true when creating it?
icy maple

It has a debug event typed

player has a debug option, no description

fiery blade

yup

fiery blade

that would be cleaning data when resource is changed

icy maple

I don’t see debug being used anywhere other than in stateChange

Unless it’s used in a different file

I’m tempted to try adding an error listener to resource.playStream

fiery blade
icy maple

That’s all I saw

No info that isn’t alr available

fiery blade

but it stringifies the state too

green vigil

I can't triger the command the company I use limits it

I ran it on my personal console and it said

Method invocation failed because [System.String] does not contain a method named 'generateDependencyReport'.

icy maple

Just print it manually ig

console.log(require("@discordjs/voice").generateDependencyReport())

green vigil

Where would I put it cause I put it down and it didn't work

nvm ik where

Core Dependencies
- @discordjs/voice: 0.10.0-dev
- prism-media: 1.3.4
Opus Libraries
- @discordjs/opus: not found
- opusscript: 0.0.8
Encryption Libraries
- sodium-native: not found
- sodium: 3.0.2
- libsodium-wrappers: 0.7.10
- tweetnacl: not found
FFmpeg
- version: 5.0.1-static https://johnvansickle.com/ffmpeg/ 
- libopus: yes

@icy maple Sry for ping but incase ^^

balmy plank

hey, I recently encountered this error. Is there a way to fix this error???

icy maple

Voice still uses miniget? Thinkeng

icy maple

The site is prob down

balmy plank
icy maple

Soon, we'll get a native fetch in node.js

balmy plank
viscid saffron

Been trying to make a slash command that plays an mp3 file in vc, this is what I have atm

const { SlashCommandBuilder } = require("@discordjs/builders");
const {joinVoiceChannel, createAudioPlayer, createAudioResource, entersState, StreamType, AudioPlayerStatus, VoiceConnectionStatus} = require("@discordjs/voice");
const discord = require('discord.js');

module.exports = {
    data: new SlashCommandBuilder()
            .setName('tts')
            .setDescription('A text to speech command for voice channels!'),
            //.addStringOption(option => option.setName('message').setDescription('The message you wish to send.').setRequired(true)),
    async execute(interaction) {   
        let channel = interaction.member.guild.channels.cache.get(interaction.member.voice.channel.id);

          const connection = joinVoiceChannel({
            channelId: channel.id,
            guildId: channel.guild.id,
            adapterCreator: channel.guild.voiceAdapterCreator,
            selfDeaf: false,
            selfMute: false
          })    

          const player = createAudioPlayer({
            behaviors: {
              noSubscriber: NoSubscriberBehavior.Pause,
            },
          });          

          connection.subscribe(player)
          const resource = createAudioResource("/home/fibreopticbroadbean/Geoff/FileName.mp3")
          player.play(resource); 
        
    },
}

The bot is able to join the vc, but nothing happens afterwards. This is the error I'm getting, not sure why (if it helps I'm using a Raspberry Pi 2 Model B)

subtle granite

This error seems to come from an embed message you try to create

fickle raft
const { joinVoiceChannel, createAudioPlayer, createAudioResource, AudioPlayerStatus } = require("@discordjs/voice");
const { Message } = require("discord.js");
const googleTTS = require("google-tts-api")

module.exports = {
    data: new SlashCommandBuilder()
        .setName("speak")
        .setDescription("Make me speak in a vc")
        .addStringOption(option => 
            option.setName("text").setDescription("What do i say?").setRequired(true)
        ),
    async execute(interaction)  {
        const text = interaction.options.getString("text")
        const voicechannel = interaction.member.voice.channel

        if(!voicechannel)   {
            return interaction.reply("Please join a voice channel to use that command")
        }
        if(text.lenght > 200)   {
            return interaction.reply("Please input less than 200 characters")
        }
        let audioUrl = googleTTS.getAudioUrl(text, {
            lang: "en",
            slow: false,
            host: 'https://translate.google.com',
        })

        let player = createAudioPlayer()
        let recource = createAudioResource(audioUrl)

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

        player.play(recource)
        connection.subscribe(player);
        await interaction.reply(":)")

        
        
    }
}``` How can i make the bot disconnect after it played the url?![hmmmmm](https://cdn.discordapp.com/emojis/950703992705540096.webp?size=128 "hmmmmm") 
I tried adding: ```player.on(AudioPlayerStatus.Idle, () => {
            connection.disconnect();
        })```but it disconnected way too early
waxen wedge
waxen wedge
waxen wedge
fiery yew

is there any way to make a bot play video in a vc with djs, or in general?
i have a thing that sends images of the game board, but it fills up the channel a lot...

fiery yew
green vigil

My bot keeps idling

Installed Packages
Logged in as cfsgames#2941!
idle
buffering
Playing, Orlando Radio
buffering
playing
playing
autopaused
autopaused
playing
playing
idle
- @discordjs/voice: 0.10.0-dev
- prism-media: 1.3.4
Opus Libraries
- @discordjs/opus: 0.8.0
- opusscript: 0.0.8
Encryption Libraries
- sodium-native: 3.3.0
- sodium: 3.0.2
- libsodium-wrappers: 0.7.10
- tweetnacl: 1.0.3
FFmpeg
- version: 5.0.1-static https://johnvansickle.com/ffmpeg/ 
- libopus: yes
icy maple
green vigil
green vigil

This happens when I try to install pulse audio

npm ERR! gyp ERR! find Python You need to install the latest version of Python.
npm ERR! gyp ERR! find Python Node-gyp should be able to find and use Python. If not,
npm ERR! gyp ERR! find Python you can try one of the following options:
npm ERR! gyp ERR! find Python - Use the switch --python="C:\Path\To\python.exe"
npm ERR! gyp ERR! find Python   (accepted by both node-gyp and npm)
npm ERR! gyp ERR! find Python - Set the environment variable PYTHON
npm ERR! gyp ERR! find Python - Set the npm configuration variable python:
npm ERR! gyp ERR! find Python   npm config set python "C:\Path\To\python.exe"
npm ERR! gyp ERR! find Python For more information consult the documentation at:
npm ERR! gyp ERR! find Python https://github.com/nodejs/node-gyp#installation
finite grotto
green vigil
green vigil

I must be very blind never seen that

Ok, so I get no errors I have all the core dependencies but audio still won't play on a linux server but plays on Visual Studio Code

green vigil

The Owner of the hosting company fixed it

undone anvil

If I have multiple Discord bots connected to Discord, is there a way to join a voice channel with a specific bot?
An example of what I want to do:

const client1 = new Discord.Client({ ... })
const client2 = new Discord.Client({ ... })
const client3 = new Discord.Client({ ... })
// join voice channel with client2

The end goal is to join a voice channel with multiple bots, but when I use ```ts
// iteration over clients, where vc = await client.channels.fetch(id) for each client
joinVoiceChannel({
channelId: vc.id,
guildId: vc.guild.id,
adapterCreator: vc.guild.voiceAdapterCreator as DiscordGatewayAdapterCreator
})

it only joins with 1
tall rain

Hey, this code is recording the voice chat members from disocrd and send it as file

But i have the probelm, when i went silence, the sound start to lagging ,

The code file: https://pastecord.com/wyfehygizu

The record file: record_9.mp3

You can see this record file so you can know what i mean with lagging

waxen wedge
opaque crag

how can I check if two audio resources are the same?

im trying to make a remove dups command

void fog
worldly scroll

is there a way to record a voice Channel to a pipe instead of a file then Play that same pipe to a 2nd Channel.

trying to create a relay without using the hard drive just ram.

any thoughts?

worldly scroll

reading thanks.

tall rain

hey i need help with this., So this code is recording the voice chat members from disocrd and send it as file

But i have the probelm, when i went silence, the sound start to lagging ,

The code file: https://pastecord.com/wyfehygizu

The record file: record_9.mp3

You can see this record file so you can know what i mean with lagging

waxen wedge
atomic totem

Hey guys, Im having an issue where the bot connects, starts reproducing the resource and then, exactly after 1 minute, the voice connection goes to the signalling status, I have swapped from ytdl to play-dl, I also checked the 'GUILD_VOICE_STATES'
some logs here

Player, new state =>  buffering
Voice Connection, new State =>  ready
Player, new state =>  playing
Voice Connection, new State =>  connecting
Voice Connection, new State =>  signalling

If i forcefully move the bot from another channel he will reconnect and keep playing, and stops after 1 minute

Voice Connection, new State =>  connecting
Voice Connection, new State =>  connecting
Voice Connection, new State =>  connecting
Voice Connection, new State =>  connecting
Voice Connection, new State =>  ready

Is there some kind of protection or "afk" system or anything that would remove the voice connection from ready to signalling?

cursive sapphire

i get this error Error: aborted can anyone tell me how and why this occurs?

dusty needleBOT

AbortError: The user aborted a request.
A request took longer than the specified restRequestTimeout (15 seconds default), and was aborted to not lock up the request handler.
• This can be caused by an internal server error on Discord's side, or just a slow connection.
• In case of a slow connection, the restRequestTimeout option in ClientOptions can be increased to prevent future AbortErrors.

regal fulcrum

@cursive sapphire

cursive sapphire

thanks

cursive sapphire
regal fulcrum

Wdym?

cursive sapphire

i mean how can i use it?

regal fulcrum

oh you need to include it in your client constructor

cursive sapphire

oh yea

regal fulcrum

where you put your intents

cursive sapphire

after intents i put there, it shows the option for me :) thanks

what parameter i should put and what will it do?

i cant understand what they put in description in the docs

also if u reply, ping and reply

@regal fulcrum

regal fulcrum

sorry hey wassup

regal fulcrum
cursive sapphire
regal fulcrum

yea sorry ms

cursive sapphire

hmm

regal fulcrum

its 15000 by default

cursive sapphire

i put 100000, nothing will happen right?

regal fulcrum

That means its got 100s before it will error out if i understand correctly

cursive sapphire

hmmmm

i changed to 30000 ms itself, anyways

regal fulcrum

yea that should be fine

cursive sapphire

same result

damn, ill create a thread because this slowmode is...... ok ok i control myself

subtle granite

Just want to connect to a voice channel (normally joining):
const { joinVoiceChannel } = require('@discordjs/voice');

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

Like the docs..
Error : channel is not defined

frank kelp

channel must be a VoiceChannel

atomic totem

Hey, I'm using "joinVoiceChannel" to join a voice channel, but after 1 minute the state goes from "ready" to connecting and then signaling, and the only way to go back to ready is by forcing a channel change, and if I do that, 1 min later it will go back again to connecting and then signaling.

Is there a way to prevent this?

subtle granite
waxen wedge
subtle granite

haha ok

finite grotto
finite grotto
slim oyster
            if (cmd === 'speak') {
                if (!args[1]) return message.reply('Please specify text.');
                if (args[2]) return message.reply('Too many arguments.');

                const { voice } = message.member;

                let string = args[1];
                let voiceChannel = message.member.voice.channel;

                if (string.length > 500) return message.channel.send("I can only speak 500 words!");
                if (!voiceChannel) return message.channel.send("Please join a voice channel to use this command!");

                let audioUrl = getAudioUrl(string, {
                    lang: "en",
                    slow: false,
                    host: 'https://translate.google.com',
                    timeout: 20000,
                });

                let player = createAudioPlayer();
                let resource = createAudioResource(audioUrl);

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

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

                player.on(AudioPlayerStatus.Idle, () => {
                    connection.disconnect();
                });
            };

No errors just won't play audio

rough knot
  .on('finish', queue => queue.textChannel.send('Finished!')),

how i can make it when finish bot leave from channel?

finite grotto
dusty needleBOT

method VoiceConnection#destroy()
Destroys the VoiceConnection, preventing it from connecting to voice again. This method should be called when you no longer require the VoiceConnection to prevent memory leaks.

rough knot
finite grotto
rough knot
dusty needleBOT

Suggestion for @rough knot:
guide Library: Cheat sheet - Access
read more

rough knot
finite grotto
rough knot

edited

finite grotto

👍

rough knot
finite grotto 👍
      const connection = getVoiceConnection(guild.id)
                         ^

ReferenceError: getVoiceConnection is not defined

oh yea my bad!

rough knot
finite grotto
rough knot how i can define the guild?

I imagine your queue is instanced to each guild with some identifier, but even if that doesn't involve the guild id, if queue.voiceChannel is a djs VoiceChannel object, <VoiceChannel>.guildId should be your guild id

rough knot

so

i can use queue.guild.id?

finite grotto
rough knot
finite grotto I don't know what `queue` is or how you set it up
client.distube
  .on('playSong', (queue, song) =>
    queue.textChannel.send(
      `${client.emotes.play} | Playing \`${song.name}\` - \`${song.formattedDuration}\`\nRequested by: ${
        song.user
      }\n${status(queue)}`
    )
  )
  .on('finish', queue => {
      const connection = getVoiceConnection(queue.guild.id)
      connection.destroy(); 
      queue.textChannel.send('Finished!');
      }),
finite grotto
rough knot
finite grotto
rough knot `guildId` and `guild.id` is the same?

they would be the same id
<VoiceChannel>.guildId is technically more stable than <VoiceChannel>.guild.id, as guildId is guaranteed to be there while guild is only present if djs is able to resolve a guild for that guildId
though I'm genuinely unsure if it's possible to receive a VoiceChannel object without the guild being cached
might require some shenanigans on the developer's part

rough knot

hm

rough knot

this not working in new discordjs?

finite grotto

not working how?

rough knot

is question

finite grotto

well those are properties that potentially exist
my question is what makes you think it's not working?

rough knot
tulip elbow

can anyone tell that how to start a discordjs/@voice ?

thick palm

The bot joins the voice room well and leaves it well but it always remains in the same place if we move to another voice

if(interaction.options.getString('option') === 'voc_join'){
            if(interaction.member.permissions.has("ADMINISTRATOR")){
                joinVoiceChannel({
                    channelId: interaction.member.voice.channel.id,
                    guildId: interaction.guild.id,
                    adapterCreator: interaction.guild.voiceAdapterCreator
                })
                interaction.reply({content: `Je rejoind le salon vocal <#${interaction.member.voice.channel.id}>`, ephemeral: true})
            }
        }
        if(interaction.options.getString('option') === 'voc_leave'){
            if(interaction.member.permissions.has("ADMINISTRATOR")){
                const connection = joinVoiceChannel({
                    channelId: interaction.member.voice.channel.id,
                    guildId: interaction.guild.id,
                    adapterCreator: interaction.guild.voiceAdapterCreator
                })
                interaction.reply({content: `Je quitte le salon vocal <#${interaction.member.voice.channel.id}>`, ephemeral: true})
                connection.destroy();
            }
        }
finite grotto
cold geode

hey, guys. help me fix this error

const stream = await ytdl(track.url, guildQueue?.filter?.value || null);
                const resource = createAudioResource(stream, { inputType: StreamType.OggOpus, inlineVolume: true });
                const guildDispatcher = guildQueue.dispatcher;

                try {
                    await entersState(connection, VoiceConnectionStatus.Ready, 10_000);

                    guildDispatcher.setMaxListeners(0);
                    guildDispatcher.play(resource);

                    (connection.state as any).subscription?.player ? false : connection.subscribe(guildDispatcher);
                }catch(error){
                    if(connection.state.status != VoiceConnectionStatus.Destroyed) connection.destroy();

                    return this.emit('error', { channel: { text: track.channel.text, voice: track.channel.voice }, requested: track.requested, method: 'initGuildTrack', error: error });
                }
waxen rover

Could someone help me with this error ?
I use >> member.setMute(true, "reason");
and it said
member.setMute is not a function

icy maple
waxen rover
coarse topaz

hello

so im making my bot leave and join a voice channel when I make it leave it for some reason send the ip and port of the users running the command

or maybe its sending the ip of the machine its running on

    at Socket.<anonymous> (C:\Users\User\Desktop\Development Tools\Coding\Upgrading Discord\Uni-Mod-Bot\node_modules\@discordjs\voice\dist\index.js:353:46)
    at Object.onceWrapper (node:events:645:28)
    at Socket.emit (node:events:538:35)
    at socketCloseNT (node:dgram:746:8)
    at processTicksAndRejections (node:internal/process/task_queues:82:21)```

basically sends this but the ip and port are filled in

waxen wedge
coarse topaz
waxen wedge

Or IP of discord server

coarse topaz

what type of data am i meant to enter in .subscribe

i installed ffempeg from what ive seen others do and then they simply just use the filepath to get the audio file and it works for them

dusty needleBOT

Suggestion for @coarse topaz:
guide Library: Cheat sheet - Playing audio
read more

finite grotto

it should be an AudioPlayer

but yes you can create an AudioResource from filepath

coarse topaz
cold geode
icy maple

Meaning it caused it error

Unless ur messing w/ that package's internals or privates

cold geode
icy maple

I just use /voice directly

cold geode

FFmpeg arguments

icy maple

That’s not relevant, it says that it tried to play a resource that ended

cold geode

Well, the resource has been created, I can’t delete it either, it turns out that the wrong resource is initially created?

icy maple

Ur supposed to create a new one every time you provide one for player.play

cold geode

I just don't understand why it only happens with 1 link

icy maple

I can only help if ur able to recreate the issue w/o any 3rd party packages

You could actually open an issue if you do

coarse topaz

is there anyway to check the length of audio the player is playing

stoic beacon
{
  op: 'event',
  reason: 'Session is no longer valid.',
  code: 4006,
  byRemote: true,
  type: 'WebSocketClosedEvent',
  guildId: ''
}```
When my bot is in a voice channel for too long
I am facing this problem
foggy terrace

why are you making a variable for the console.. when you don’t need to

cursive sapphire

what is the basic code to make the bot play an audio?

can anyone gimme an example?

cursive sapphire
const { MessageEmbed } = require('discord.js');
const { joinVoiceChannel, createAudioPlayer, NoSubscriberBehavior, AudioResource, createAudioResource } = require('@discordjs/voice');
const yts = require('yt-search');
const ytdl = require('ytdl-core');

module.exports = {
  description: `Plays a song for you!`,
  run: async (client, msg, args) => {
    if (!msg.member.voice.channel) return msg.reply(`Join a voice channel first!`);

    const search = args.join(' ').trim();
    const url = await yts(search).then(x => x.all[0].url);

    let downloadInfo = await ytdl.getInfo(url);

    let channel = joinVoiceChannel({
      channelId: msg.member.voice.channel.id,
      guildId: msg.guild.id,
      adapterCreator: msg.guild.voiceAdapterCreator
    });

    let stream = await ytdl(downloadInfo.videoDetails.video_url)

    let embed = new MessageEmbed()
      .setDescription(`Playing **[${downloadInfo.videoDetails.title}](${downloadInfo.videoDetails.video_url})** now!`)

    const player = createAudioPlayer({ behaviors: NoSubscriberBehavior.Play });
    let resouce = createAudioResource(stream);

    try {
      player.play(resouce);
      channel.subscribe(player);
      await msg.reply({
        embeds: [embed], allowedMentions: { repliedUser: false }
      });
    } catch (e) {
      console.log(e);
      return msg.reply(`I went through some problems sorry!`);
    }
  }
}```the bot is not playing the music but sends the embed message
austere bolt

issue with the package you're using to play music

cursive sapphire

but that's not playing

audioplayer from @discordjs/voice

open hawk

Where is throwed the VOICE_SERVER_UPDATEevent?

cursive sapphire

huh?

open hawk

wait no I think that this is something the bot should send

mb

cursive sapphire

example?

foggy terrace
open hawk

Ik, that's why I'm searching it in djs...

cursive sapphire

it doesn't even throw any error bro

just sends the embed message but not playing the searched song

fervent estuary
tall rain
slender sparrow

find replace exist for some reason

tall rain
stoic beacon
tall rain

hey i need help with this., So my code is recording the voice chat members from disocrd and send it as file

But i have the probelm, when i change silence to manual, the sound start to lagging, which is weird?

channel.members.filter(mo => mo.user.id !== bot.user.id).forEach(async abb => {
        const receiver = connection.receiver.createStream(abb, {
          mode: "pcm",
          end: "manual"
        });
})

You can see this record file so you can know what i mean with lagging

white arrow

djs Archived to focus conversation on #998942774994927646 (our shiny forum channel) and kept read-only to facilitate in-app search (CTRL+F) for solutions to problems that have already been asked.
If your issue has not been solved yet, feel free to re-post in the new channel