You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am attempting to build a discord music bot with discordjs. I have previously built music playing bots that have worked completely fine however now the bot is not joining the voice channel. I don't think it's an issue with play-dl since the bot isn't even joining any channel and there are no error messages.
The bot will sometimes also appear offline for a few seconds before coming back online when the user submits a new interaction.
For this, I have designed it where when a user submits a new query, an entry is saved to mongodb that contains information from play-dl, the guildId, and the voiceChannelId. An event is then emitted that retrieves the next item in the queue, creats a voice connection if necessary, then plays the song. I have confirmed that the correct ids are being saved and used. I have also confirmed that the event does fire and the handler is called.
Everything i've read up on the documentation says this should be working however I don't know if i'm just missing something. I've tried all other avenues to find a solution but I haven't found anything that works. Additionally it does not seem to cause an error as there are no error messages and all the logs print.
Code sample
// my clientconstclient=newClient({intents: [GatewayIntentBits.Guilds,GatewayIntentBits.GuildMessages,GatewayIntentBits.GuildVoiceStates]});// event handler after user submissionevents.on(eventNames.PlayNextEvent,async()=>{logger.logInfo(eventNames.PlayNextEvent);constitem=awaitqueue.next();constguild=client.guilds.cache.get(item.guildId);// establish voice channel connectionif(!VoiceConnection){logger.logInfo(`creating voice connection in guild ${item.guildId} in channel ${item.voiceChannelId}...`);// global variable created outside the handlerVoiceConnection=joinVoiceChannel({channelId: item.voiceChannelId,guild: guild.id,adapterCreator: guild.voiceAdapterCreator,selfMute: false,debug: true});VoiceConnection.on('debug',(m)=>{console.log('Voice Debug:',m);});}conststream=awaitplay.stream(item.info.url);if(!stream){logger.logError('stream is null');return;}constresource=createAudioResource(stream.stream,{inputType: stream.type});letdiscordPlayer=createAudioPlayer({behaviors: {noSubscriber: NoSubscriberBehavior.Stop}});discordPlayer.play(resource);VoiceConnection.subscribe(discordPlayer);logger.logInfo(`playing "${item.title}"`);VoiceConnection.on('stateChange',(oldState,newState)=>{console.log(`Connection transitioned from ${oldState.status} to ${newState.status}`);});});
Versions
discordjs 14.14.1
@discordjs/voice 0.16.1
@discordjs/builders 1.7.0
node 20.11.1
Issue priority
Medium (should be fixed soon)
Which partials do you have configured?
No Partials
Which gateway intents are you subscribing to?
Guilds, GuildVoiceStates, GuildMessages
I have tested this issue on a development release
No response
The text was updated successfully, but these errors were encountered:
Which package is this bug report for?
voice
Issue description
Apologies if this is not categorized correctly.
I am attempting to build a discord music bot with discordjs. I have previously built music playing bots that have worked completely fine however now the bot is not joining the voice channel. I don't think it's an issue with
play-dl
since the bot isn't even joining any channel and there are no error messages.The bot will sometimes also appear offline for a few seconds before coming back online when the user submits a new interaction.
For this, I have designed it where when a user submits a new query, an entry is saved to mongodb that contains information from
play-dl
, the guildId, and the voiceChannelId. An event is then emitted that retrieves the next item in the queue, creats a voice connection if necessary, then plays the song. I have confirmed that the correct ids are being saved and used. I have also confirmed that the event does fire and the handler is called.Everything i've read up on the documentation says this should be working however I don't know if i'm just missing something. I've tried all other avenues to find a solution but I haven't found anything that works. Additionally it does not seem to cause an error as there are no error messages and all the logs print.
Code sample
Versions
Issue priority
Medium (should be fixed soon)
Which partials do you have configured?
No Partials
Which gateway intents are you subscribing to?
Guilds, GuildVoiceStates, GuildMessages
I have tested this issue on a development release
No response
The text was updated successfully, but these errors were encountered: