rorified
rorified
DIAdiscord.js - Imagine an app
Created by rorified on 10/9/2023 in #djs-voice
The bot is stuck at the "connecting" state and not going to the "ready" state
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"]);
5 replies
DIAdiscord.js - Imagine an app
Created by rorified on 10/9/2023 in #djs-voice
The bot is stuck at the "connecting" state and not going to the "ready" state
5 replies
DIAdiscord.js - Imagine an app
Created by rorified on 10/9/2023 in #djs-voice
The bot is stuck at the "connecting" state and not going to the "ready" state
Thank you!! I was able to fix it, I appreciate your help a lot 😄
5 replies
DIAdiscord.js - Imagine an app
Created by rorified on 10/9/2023 in #djs-voice
The bot is stuck at the "connecting" state and not going to the "ready" state
The firewall is turned off and I am not using any proxies or vpns 🥲
5 replies