The bot is stuck at the "connecting" state and not going to the "ready" state

I am really sorry for reopening. I tried adding the debug console but wasn't able to identify the error, I was convinced that it was fixed when I saw my bot enter the "ready state" on the debug console. But the thing is, the bot only enters the ready state when it leaves the vc, but it stays in connecting state when its in the vc
4 Replies
d.js toolkit
d.js toolkit14mo 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!
ShompiFlen
ShompiFlen14mo ago
it sounds like you are missing the GuildVoiceStates intent
rorified
rorifiedOP14mo ago
I have it enabled
const dotenv = require('dotenv');
const fs = require('node:fs');
const path = require('node:path');
const {
Client,
GatewayIntentBits,
Collection
} = require('discord.js');

dotenv.config();

function setCommands(app) {
app.commands = new Collection();
const commandsPath = path.join(__dirname, 'commands');
const commandFiles = fs.readdirSync(commandsPath).filter(file => file.endsWith('.js'));
for (const file of commandFiles) {
const filePath = path.join(commandsPath, file);
const command = require(filePath);
if ('data' in command && 'execute' in command) {
app.commands.set(command.data.name, command);
console.log(`[SetCmd] ${command.data.name}`);
} else {
console.log(`[WARNING] The command at ${filePath} is missing a required "data" or "execute" property.`);
}
}
}

function setEvents(app) {
const eventsPath = path.join(__dirname, 'events');
const eventFiles = fs.readdirSync(eventsPath).filter(file => file.endsWith('.js'));

for (const file of eventFiles) {
const filePath = path.join(eventsPath, file);
const event = require(filePath);
if (event.once) {
app.once(event.name, (...args) => event.execute(...args, app));
} else {
app.on(event.name, (...args) => event.execute(...args, app));
}
}
}

const app = new Client({
intents: [
GatewayIntentBits.Guilds,
GatewayIntentBits.GuildPresences,
GatewayIntentBits.GuildMessages,
GatewayIntentBits.MessageContent,
GatewayIntentBits.GuildMembers,
GatewayIntentBits.GuildEmojisAndStickers,
GatewayIntentBits.DirectMessages,
GatewayIntentBits.GuildVoiceStates
],
failIfNotExists: true
});

require("./deploy-commands");
setCommands(app);
setEvents(app);

app.login(process.env["TOKEN"]);
const dotenv = require('dotenv');
const fs = require('node:fs');
const path = require('node:path');
const {
Client,
GatewayIntentBits,
Collection
} = require('discord.js');

dotenv.config();

function setCommands(app) {
app.commands = new Collection();
const commandsPath = path.join(__dirname, 'commands');
const commandFiles = fs.readdirSync(commandsPath).filter(file => file.endsWith('.js'));
for (const file of commandFiles) {
const filePath = path.join(commandsPath, file);
const command = require(filePath);
if ('data' in command && 'execute' in command) {
app.commands.set(command.data.name, command);
console.log(`[SetCmd] ${command.data.name}`);
} else {
console.log(`[WARNING] The command at ${filePath} is missing a required "data" or "execute" property.`);
}
}
}

function setEvents(app) {
const eventsPath = path.join(__dirname, 'events');
const eventFiles = fs.readdirSync(eventsPath).filter(file => file.endsWith('.js'));

for (const file of eventFiles) {
const filePath = path.join(eventsPath, file);
const event = require(filePath);
if (event.once) {
app.once(event.name, (...args) => event.execute(...args, app));
} else {
app.on(event.name, (...args) => event.execute(...args, app));
}
}
}

const app = new Client({
intents: [
GatewayIntentBits.Guilds,
GatewayIntentBits.GuildPresences,
GatewayIntentBits.GuildMessages,
GatewayIntentBits.MessageContent,
GatewayIntentBits.GuildMembers,
GatewayIntentBits.GuildEmojisAndStickers,
GatewayIntentBits.DirectMessages,
GatewayIntentBits.GuildVoiceStates
],
failIfNotExists: true
});

require("./deploy-commands");
setCommands(app);
setEvents(app);

app.login(process.env["TOKEN"]);
Want results from more Discord servers?
Add your server