jimbob
DIAdiscord.js - Imagine an app
•Created by jimbob on 5/11/2024 in #djs-questions
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
},
};
7 replies