D3V1L0M3N
D3V1L0M3N
DIAdiscord.js - Imagine an app
Created by D3V1L0M3N on 12/10/2023 in #djs-voice
Discrepancy between .playable and .subscribers
Just curious to why this is. I've noticed that, after the bot has been running for some time, a discrepancy will manifest between these two lines of code. The expected behaviour is that both lines of code would output the same thing; the number of VoiceChannels that is playing/subscribed to a given AudioPlayer.
const channels = AudioPlayer.subscribers.map(s => s.connection).map(c => c.joinConfig.channelId);
const channels = AudioPlayer.subscribers.map(s => s.connection).map(c => c.joinConfig.channelId);
AudioPlayer.playable.forEach(connection => {
let channel = Client.channels.cache.get(connection.joinConfig.channelId);
console.log(channel.id);
});
AudioPlayer.playable.forEach(connection => {
let channel = Client.channels.cache.get(connection.joinConfig.channelId);
console.log(channel.id);
});
Sometimes the difference can be significant - i.e. 30 versus 80. I get that .subscribers technically shouldn't be used but I'm wondering how/why a channel would be left in .subscribers but is not "playable". Is it bug? Is discordjs/voice leaving garbage channels behind that should've been removed? Or is this expected behaviour. And what circumstances can have a channel classified as a subscriber but is not playable? I've tested permissions and dirty disconnecting the voice but can't intentionally reproduce. discord.js/voice: 0.16.1 discord.js: 14.14.1
4 replies
DIAdiscord.js - Imagine an app
Created by D3V1L0M3N on 3/12/2023 in #djs-voice
Audio stops playing
Yeah, it's another one of these posts and at this point I've pretty much lost all patience with this broken library. The issue is that, after joining a voice channel and beginning to stream audio (from an arbitrary URL source) for a bit, the bot will stop producing any sound and appears to have stopped transmitting audio to discord altogether (based on Network Activity dropping to nil). That's not the worse part. discordjs/voice lib does not produce any output to voice connection debug or stateChange event listeners when this happen. See: https://discordjs.dev/docs/packages/voice/0.11.0/VoiceConnection:Class#on It also produces no output to audio player stateChange event listeners when it happens. See: https://discordjs.dev/docs/packages/voice/0.11.0/AudioPlayer:Class#on Basically, discordjs/voice stops playing audio and doesn't give so much as a whisper as to why. No errors. Nothing. Looking around this Discord, it seems loads of people are experiencing these issues, yet we have gotten no updates, fixes or information about works towards a resolution. My question is this: What are the plans for the future of discordjs/voice? Is it still being actively maintained and are there plans to iron out all the issues existing in it's current state? Or should I avoid wasting any more of my time trying to debug, and hack around, these issues?
63 replies
DIAdiscord.js - Imagine an app
Created by D3V1L0M3N on 2/3/2023 in #djs-voice
AudioPlayer.playable includes undefined channels
I've noticed a bug that comes and goes infrequently where AudioPlayer.playable includes voice connections whose joinConfig.channelId references a channel that doesn't exist. For example, I would like to run some code for every active voice connection. I do this as follows:
audioPlayer.playable.forEach(connection => {
let channel = Client.channels.cache.get(connection.joinConfig.channelId);

// do some cool stuff 😎
});
audioPlayer.playable.forEach(connection => {
let channel = Client.channels.cache.get(connection.joinConfig.channelId);

// do some cool stuff 😎
});
I expect channel to be set to the Voice Channel in which the connection is in, however in some rare cases, channel ends up being undefined. No sharding has been implemented so I would expect the bot to have cached every channel it has access to. Relevant Documentation Page: https://discordjs.dev/docs/packages/voice/0.11.0/AudioPlayer:Class#playable
2 replies
DIAdiscord.js - Imagine an app
Created by D3V1L0M3N on 8/31/2022 in #djs-questions
Typo on discordjs.guide website
7 replies