discord.js - Imagine a 👻

DIA

discord.js - Imagine a 👻

Support server for discord.js, a Node.js module to interact with Discord's apps API.

Join

djs-questions

djs-voice

Create a "radio"

I'm trying to create a radio, or soundboard of sorts. A place where I can select the songs or sounds I want, and have it be played by the bot. I'm probably overthinking this or structuring it wrong. But my idea would be to have a constant stream the bot is playing, so I can append audio buffers to it (from a folder). I'd probably be better off with creating a new player every time, but I want to merge tracks together, have it played on top of one another. I already have a Readable stream the bot can play, but when I append a single track to it, it thinks the Readable is finished playing and the bot goes idle (I can't play the resource again). Essentially it should behave like a radio. I even tried appending silence to it so it's not "empty". I don't know how to approach this...

Trying to play a local wav file in a vc but it doesn't play more than a min.

Trying to play a local wav audio file in a vc but it doesn't play for more than a min even though the actual file is of 3 mins. Code: ```js if (GuildVoice.has(message.guild.id)) return message.reply("Sorry! already in another voice channel");...

Script plays local files well but can't play url streams, why?

```js const Discord = require('discord.js'); const { Client, GatewayIntentBits } = require('discord.js'); const client = new Client({ intents: [ ...

Error [ERR_STREAM_WRITE_AFTER_END]: write after end

write after end Error [ERR_STREAM_WRITE_AFTER_END]: write after end at new NodeError (node:internal/errors:372:5) at _write (node:internal/streams/writable:320:11) at Socket.Writable.write (node:internal/streams/writable:335:10)...

15 second pause when initializing Decoder

i am trying to use @discordjs/voice's prism-media package to convert the data into pcm and i noticed that the first time the decoder is constructed it takes around 15.5 seconds and then works just fine. Am i missing something or is it meant to be that slow?

The system does not work when the bot is on have voice channel and when someone enters the sound

When i put the bot in the voice channel with the command, the command does not work when someone comes or when someone enters the voice normally, the bot enters the voice and plays the mp3, if they exit and enter, the bot stops talking

My bot doesn't play any sound, he has permission to speak and the intents

My bot doesn't play any sound, he has permission to speak and the intents ```const { joinVoiceChannel, createAudioResource, createAudioPlayer } = require('@discordjs/voice'); const voice = require("@discordjs/voice");...

How can I use opus to make my bot playing a specific mp3. in a voice channel with the command /play

I want to make a bot playing specific .mp3 in a voice channel, like that : /play {name of the mp3} and he play it

How to get the audioResource

I want to get the audioReasource to delete it, and i'm doing like this when it finish ```js const resource = createAudioResource(playObj.path); player.play(resource); ...

Problem installing @discordjs/opus on arch linux

I've got some problem installing discordjs/opus on my arch linux I will send the error in the morning...

system bot

how to create bot system

Shard Reconnection and Voice Connection

Will the voice connection automatically restart if a shard is asked to restart? I've been running into some problems where a shard has to restart and then the audio connection disconnects. Is there a way I can listen for this type of problem and have my bot reconnect when it happens? Or is it already supposed to be reconnecting and this is a bug?

Error streaming from IceCast server (Live Broadcast)

``` file:///home/syn/DungeonMaster/node_modules/@discordjs/voice/dist/index.mjs:1051 throw new Error("Cannot play a resource that has already ended."); ^ ...

how to repeat music once it's finished

Hi, once the music playback finishes the bot crashes and I get this error ``` throw new Error("Cannot play a resource that has already ended."); ^ ...

is there a way to send voice to specific members in channel simultaneously?

as in the title, I'm searching for any way to do that. I want to play different sounds for different members in the same channel and at the same time but I couldn't figure out a way. also, I tried making the bot able to join a private call with each member but it's impossible.

Error [ERR_STREAM_WRITE_AFTER_END]: write after end

This appears after about 2m of playing an mp3 file I have stored locally.
let editedSong = ffmpeg({ source: `./songCache/${id}.mp3` }).toFormat('mp3').setStartTime(Math.ceil(json.payloads[0].seek_to / 1000))
resource = createAudioResource(editedSong);
let editedSong = ffmpeg({ source: `./songCache/${id}.mp3` }).toFormat('mp3').setStartTime(Math.ceil(json.payloads[0].seek_to / 1000))
resource = createAudioResource(editedSong);
...

AudioPlayer not working, not sure what's wrong

```ts this._audioPlayer = createAudioPlayer(); const connection = joinVoiceChannel({ channelId: voiceState.channelId, guildId: voiceState.guild.id,...

createAudioResource()

Im not sure to i should ask this here or in help channel but im going there. In docs it takes string as resource input that is a file location, but i want to ask what else we can use to create a resource or directly a resource something like a Buffer or anything else For further explanation i want to store them in mongoose database and use them in future but im not sure how i can store a audio file in mongoose or i can use it or not...

Stuck in 'Signaling'

I'm having an issue that started a few months ago, and I can't seem to figure out why. Very long story short, after exactly 1 minute of being in a voice chat, the bot's voice chat status goes into "signaling". It worked fine initially (worked for months with no issues), and then this started. I'm not finding much about it in the DJS docs, and the Discord api docs mention it's part of the heartbeat stuff ... Any direction on what I need to look at in order to get this fixed? Not having our bot is starting to suck. Thanks! There's not really any code to show, but here's the log output: It's always EXACTLY 1 minute after Ready....