Stuck in joinVoiceChannel connection stuck in signalling - any advice?
I do have the voice state intent set:
index.js
command/utility/x.js
require('dotenv/config');
const fs = require('node:fs');
const path = require('node:path');
const { Client, Collection, Events, GatewayIntentBits } = require('discord.js');
const { token } = require('./config.json');
// Create a new client instance
const client = new Client({ intents: [
GatewayIntentBits.Guilds,
GatewayIntentBits.GuildVoiceStates,
],
});
...
require('dotenv/config');
const fs = require('node:fs');
const path = require('node:path');
const { Client, Collection, Events, GatewayIntentBits } = require('discord.js');
const { token } = require('./config.json');
// Create a new client instance
const client = new Client({ intents: [
GatewayIntentBits.Guilds,
GatewayIntentBits.GuildVoiceStates,
],
});
...
module.exports = {
data: new SlashCommandBuilder()
.setName('x')
.setDescription("Plays 'x' sound effect."),
async execute(interaction) {
// interaction.user is the object representing the User who ran the command
// interaction.member is the GuildMember object, which represents the user in the specific guild
const voiceChannel = interaction.member.voice.channel;
const guildId = interaction.guild.id;
const adapterCreator = interaction.guild.voiceAdapterCreator;
const connection = joinVoiceChannel({
channelId: voiceChannel,
guildId: guildId,
adapterCreator: adapterCreator,
});
console.log(connection);
connection.on(VoiceConnectionStatus.Ready, () => {
console.log('The connection has entered the Ready state - ready to play audio!');
});
// })
await interaction.reply(`VC: ${voiceChannel} !!!! guildId: ${guildId} !!! interaction: ${adapterCreator}`); // placeholder
},
};
module.exports = {
data: new SlashCommandBuilder()
.setName('x')
.setDescription("Plays 'x' sound effect."),
async execute(interaction) {
// interaction.user is the object representing the User who ran the command
// interaction.member is the GuildMember object, which represents the user in the specific guild
const voiceChannel = interaction.member.voice.channel;
const guildId = interaction.guild.id;
const adapterCreator = interaction.guild.voiceAdapterCreator;
const connection = joinVoiceChannel({
channelId: voiceChannel,
guildId: guildId,
adapterCreator: adapterCreator,
});
console.log(connection);
connection.on(VoiceConnectionStatus.Ready, () => {
console.log('The connection has entered the Ready state - ready to play audio!');
});
// })
await interaction.reply(`VC: ${voiceChannel} !!!! guildId: ${guildId} !!! interaction: ${adapterCreator}`); // placeholder
},
};
6 Replies
- 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!
- ✅
Marked as resolved by staffconnection log output here:
<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: VoiceChannel {
type: 2,
guild: [Guild],
guildId: '1238517350760710295',
permissionOverwrites: [PermissionOverwriteManager],
messages: [GuildMessageManager],
nsfw: false,
flags: [ChannelFlagsBitField],
id: '1238517350760710299',
name: 'General',
rawPosition: 0,
parentId: '1238517350760710297',
rtcRegion: null,
bitrate: 64000,
userLimit: 0,
videoQualityMode: null,
lastMessageId: null,
rateLimitPerUser: 0
},
guildId: '1238517350760710295',
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: VoiceChannel {
type: 2,
guild: [Guild],
guildId: '1238517350760710295',
permissionOverwrites: [PermissionOverwriteManager],
messages: [GuildMessageManager],
nsfw: false,
flags: [ChannelFlagsBitField],
id: '1238517350760710299',
name: 'General',
rawPosition: 0,
parentId: '1238517350760710297',
rtcRegion: null,
bitrate: 64000,
userLimit: 0,
videoQualityMode: null,
lastMessageId: null,
rateLimitPerUser: 0
},
guildId: '1238517350760710295',
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
}
Unknown User•8mo ago
Message Not Public
Sign In & Join Server To View
channelId should be the id of the channel, i don't think it's ChannelResolvable (I maybe wrong here)
:propertysignature: JoinVoiceChannelOptions#channelId
@0.17.0
The id of the Discord voice channel to join.Thank you! that was it :^)