#Thread

1 messages · Page 1 of 1 (latest)

noble umbra
#

I'm a little confused to what this image shows exactly

west obsidian
#

the bot is logged in

noble umbra
#

Have you tried to do a dummy file with the bare min of code?

west obsidian
#

nope

#

btw i tried this console.log(client.isReady())

#

and its responding with false

noble umbra
#

Thats what I thought, it means your bot isn't logged in when it hits your code

client.login(token) is async and thus it runs in the background
You can either await it with await but the proper way would be to use the clien.on("ready", () => {}) way where the function is your code you want to run once the bot is properly logged in

west obsidian
#
////////////////////////////////Ready////////////////////////////////////////
client.on('ready', () => {
console.log(`[API] Logged in as ${client.user.username}`);
client.user.setStatus(`idle`)
client.user.setActivity(`Watching in Dark`)
})

////////////////////////////////Logging////////////////////////////////////////
console.log(process.version)
module.exports = client;
client.events = new Collection();
client.slashCommands = new Collection();
require("./handlers");
client.login(config.token).then(() => {
    loadEvents(client, color);
    loadCommands(client, color);
}).catch(err => {
    console.log(`${color.bold.red(`[INDEX ERROR]`)} ` + `${err}`.bgRed);
});
noble umbra
#

Why did you do .then(() => { loadEvents(client, color); loadCommands(client, color); }) exactly? You should just put it into the ready callback

west obsidian
#

to load the events and commands

noble umbra
#

Well ye but the proper way is to put it into the callback as there is other stuff running after the login function has ran

west obsidian
#

ohh

noble umbra
#

I had issues myself with that as I tried awaiting the entire login process but it failed for me aswell
Putting everything into the callback has the desired effect and is also the prefered way by discord.js

west obsidian
#

oh okay

#

i'll try

#

i did it, tysm!