bot stuck in signalling state

trying to set up a music bot - cant get it to join my VC djs 14.15.2 /voice 0.17.0 Intents seem correct:
const fs = require('node:fs');
const path = require('node:path');
const { Client, Collection, Events, GatewayIntentBits } = require('discord.js');
require('dotenv').config()
const token = process.env.BOT_TOKEN;

const client = new Client({
intents: [
GatewayIntentBits.Guilds,
GatewayIntentBits.GuildVoiceStates,
GatewayIntentBits.GuildMessages,
GatewayIntentBits.MessageContent
],
});
...
const fs = require('node:fs');
const path = require('node:path');
const { Client, Collection, Events, GatewayIntentBits } = require('discord.js');
require('dotenv').config()
const token = process.env.BOT_TOKEN;

const client = new Client({
intents: [
GatewayIntentBits.Guilds,
GatewayIntentBits.GuildVoiceStates,
GatewayIntentBits.GuildMessages,
GatewayIntentBits.MessageContent
],
});
...
./commands/play.js file:
async function playSong(interaction, url) {
const guild = interaction.member.guild;
const member = guild.members.cache.get(interaction.member.user.id);
const voiceChannel = member.voice.channel;


if (!voiceChannel) {
return interaction.reply('join vc first');
}

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

console.log(connection);

console.log('ppl in vc: ', voiceChannel.members);

...
async function playSong(interaction, url) {
const guild = interaction.member.guild;
const member = guild.members.cache.get(interaction.member.user.id);
const voiceChannel = member.voice.channel;


if (!voiceChannel) {
return interaction.reply('join vc first');
}

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

console.log(connection);

console.log('ppl in vc: ', voiceChannel.members);

...
3 Replies
d.js toolkit
d.js toolkit7mo ago
- What's your exact discord.js npm list discord.js and node node -v version? - Not a discord.js issue? Check out #other-js-ts. - Consider reading #how-to-get-help to improve your question! - Explain what exactly your issue is. - Post the full error stack trace, not just the top part! - Show your code! - Issue solved? Press the button!
soup
soupOP7mo ago
The little output ive got:
<ref *1> VoiceConnection {
_events: [Object: null prototype] {},
_eventsCount: 0,
_maxListeners: undefined,
rejoinAttempts: 0,
_state: {
status: 'signalling',
adapter: {
sendPayload: [Function: sendPayload],
destroy: [Function: destroy]
}
},
joinConfig: {
selfDeaf: true,
selfMute: false,
group: 'default',
channelID: '1244374289491169393',
guildId: '1244365081584861216',
adapterCreator: [Function (anonymous)]
},
packets: { server: undefined, state: undefined },
receiver: VoiceReceiver {
voiceConnection: [Circular *1],
ssrcMap: SSRCMap {
_events: [Object: null prototype] {},
_eventsCount: 0,
_maxListeners: undefined,
map: Map(0) {},
[Symbol(kCapture)]: false
},
subscriptions: Map(0) {},
connectionData: {},
speaking: SpeakingMap {
_events: [Object: null prototype] {},
_eventsCount: 0,
_maxListeners: undefined,
users: Map(0) {},
speakingTimeouts: Map(0) {},
[Symbol(kCapture)]: false
},
onWsPacket: [Function: bound onWsPacket],
onUdpMessage: [Function: bound onUdpMessage]
},
debug: null,
onNetworkingClose: [Function: bound onNetworkingClose],
onNetworkingStateChange: [Function: bound onNetworkingStateChange],
onNetworkingError: [Function: bound onNetworkingError],
onNetworkingDebug: [Function: bound onNetworkingDebug],
[Symbol(kCapture)]: false
}
<ref *1> VoiceConnection {
_events: [Object: null prototype] {},
_eventsCount: 0,
_maxListeners: undefined,
rejoinAttempts: 0,
_state: {
status: 'signalling',
adapter: {
sendPayload: [Function: sendPayload],
destroy: [Function: destroy]
}
},
joinConfig: {
selfDeaf: true,
selfMute: false,
group: 'default',
channelID: '1244374289491169393',
guildId: '1244365081584861216',
adapterCreator: [Function (anonymous)]
},
packets: { server: undefined, state: undefined },
receiver: VoiceReceiver {
voiceConnection: [Circular *1],
ssrcMap: SSRCMap {
_events: [Object: null prototype] {},
_eventsCount: 0,
_maxListeners: undefined,
map: Map(0) {},
[Symbol(kCapture)]: false
},
subscriptions: Map(0) {},
connectionData: {},
speaking: SpeakingMap {
_events: [Object: null prototype] {},
_eventsCount: 0,
_maxListeners: undefined,
users: Map(0) {},
speakingTimeouts: Map(0) {},
[Symbol(kCapture)]: false
},
onWsPacket: [Function: bound onWsPacket],
onUdpMessage: [Function: bound onUdpMessage]
},
debug: null,
onNetworkingClose: [Function: bound onNetworkingClose],
onNetworkingStateChange: [Function: bound onNetworkingStateChange],
onNetworkingError: [Function: bound onNetworkingError],
onNetworkingDebug: [Function: bound onNetworkingDebug],
[Symbol(kCapture)]: false
}
ppl in vc: Collection(1) [Map] {
'295949299701907456' => GuildMember {
guild: Guild {
id: '1244365081584861216',
name: 'davetest',
icon: null,
features: [],
commands: [GuildApplicationCommandManager],
members: [GuildMemberManager],
channels: [GuildChannelManager],
bans: [GuildBanManager],
roles: [RoleManager],
presences: PresenceManager {},
voiceStates: [VoiceStateManager],
stageInstances: [StageInstanceManager],
invites: [GuildInviteManager],
scheduledEvents: [GuildScheduledEventManager],
autoModerationRules: [AutoModerationRuleManager],
available: true,
...
stickers: [GuildStickerManager]
},
joinedTimestamp: 1716750154644,
premiumSinceTimestamp: null,
nickname: null,
pending: false,
communicationDisabledUntilTimestamp: null,
user: User {
id: '295949299701907456',
bot: false,
system: false,
flags: [UserFlagsBitField],
username: 'spinaan',
globalName: 'soup',
discriminator: '0',
avatar: 'a404d5198595a04abd7a5daec641e29f',
banner: undefined,
accentColor: undefined,
avatarDecoration: null
},
avatar: null,
flags: GuildMemberFlagsBitField { bitfield: 0 }
}
}
ppl in vc: Collection(1) [Map] {
'295949299701907456' => GuildMember {
guild: Guild {
id: '1244365081584861216',
name: 'davetest',
icon: null,
features: [],
commands: [GuildApplicationCommandManager],
members: [GuildMemberManager],
channels: [GuildChannelManager],
bans: [GuildBanManager],
roles: [RoleManager],
presences: PresenceManager {},
voiceStates: [VoiceStateManager],
stageInstances: [StageInstanceManager],
invites: [GuildInviteManager],
scheduledEvents: [GuildScheduledEventManager],
autoModerationRules: [AutoModerationRuleManager],
available: true,
...
stickers: [GuildStickerManager]
},
joinedTimestamp: 1716750154644,
premiumSinceTimestamp: null,
nickname: null,
pending: false,
communicationDisabledUntilTimestamp: null,
user: User {
id: '295949299701907456',
bot: false,
system: false,
flags: [UserFlagsBitField],
username: 'spinaan',
globalName: 'soup',
discriminator: '0',
avatar: 'a404d5198595a04abd7a5daec641e29f',
banner: undefined,
accentColor: undefined,
avatarDecoration: null
},
avatar: null,
flags: GuildMemberFlagsBitField { bitfield: 0 }
}
}
dependencies:
> > --------------------------------------------------
Core Dependencies
- @discordjs/voice: 0.17.0
- prism-media: 1.3.5

Opus Libraries
- @discordjs/opus: 0.9.0
- opusscript: not found

Encryption Libraries
- sodium-native: not found
- sodium: not found
- libsodium-wrappers: 0.7.13
- tweetnacl: not found

FFmpeg
- version: 6.0-static https://johnvansickle.com/ffmpeg/
- libopus: yes
--------------------------------------------------
dependencies:
> > --------------------------------------------------
Core Dependencies
- @discordjs/voice: 0.17.0
- prism-media: 1.3.5

Opus Libraries
- @discordjs/opus: 0.9.0
- opusscript: not found

Encryption Libraries
- sodium-native: not found
- sodium: not found
- libsodium-wrappers: 0.7.13
- tweetnacl: not found

FFmpeg
- version: 6.0-static https://johnvansickle.com/ffmpeg/
- libopus: yes
--------------------------------------------------
d.js docs
d.js docs6mo ago
To debug your voice connection and player: - Use debug: true when creating your VoiceConnection and AudioPlayer - Add an event listener to the <VoiceConnection> and the <AudioPlayer>:
// Add one for each class if applicable
<AudioPlayer | VoiceConnection>
.on('debug', console.log)
.on('error', console.error)
// Add one for each class if applicable
<AudioPlayer | VoiceConnection>
.on('debug', console.log)
.on('error', console.error)
- Add an error listener to the stream you are passing to the resource:
<Stream>.on('error', console.error)
<Stream>.on('error', console.error)
Note: The <> represents classes that need to be adapted to their respective name in your code
Want results from more Discord servers?
Add your server