return client class as promise

is there a way to return the client class as a promise resolves only when the ready event gets emitted? like this:
const bot = await require('./src/utils/bot.util');
const bot = await require('./src/utils/bot.util');
2 Replies
d.js toolkit
d.js toolkit9mo 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! - Marked as resolved by staff
V2
V29mo ago
bot.util:
const { Client, GatewayIntentBits } = require('discord.js');
const client = new Client({ intents: [GatewayIntentBits.Guilds, GatewayIntentBits.GuildMembers, GatewayIntentBits.GuildIntegrations] });

client.on('ready', () => {
console.log(`Logged in as ${client.user.tag}!`);
});


client.login(process.env.BOT_TOKEN);

module.exports = client
const { Client, GatewayIntentBits } = require('discord.js');
const client = new Client({ intents: [GatewayIntentBits.Guilds, GatewayIntentBits.GuildMembers, GatewayIntentBits.GuildIntegrations] });

client.on('ready', () => {
console.log(`Logged in as ${client.user.tag}!`);
});


client.login(process.env.BOT_TOKEN);

module.exports = client
I figure it out