#No error and bot not come online
1 messages · Page 1 of 1 (latest)
Ok
Still not working
show again the whole code
That is whole code
as I said before, use client.on
const { Client, Intents } = require('discord.js');
const token = process.env['TOKEN'];
const client = new Client({ intents: [Intents.FLAGS.GUILDS] });
client.on('ready', () => {
client.user.setPresence({ activities: [{
name: 'Oto in' + client.guilds.size + 'with' + client.users.size,
type: 'PLAYING',
}], status: 'idle' });
console.log('Ready!');
});
client.login(token);
See
@tired yoke
does ready event gets fired at all? put a breakpoint at client.user.setPresence, or a console.log above it
Ok
this error should not be triggered by the code changes suggested by me. if you changed the code again, please show it
Again that old error
do a console.log(process.env['TOKEN'])
const { Client, Intents } = require('discord.js');
const config = process.env;
const client = new Client({ intents: [Intents.FLAGS.GUILDS] });
client.on('ready', () => {
client.user.setPresence({ activities: [{
name: 'Oto in' + client.guilds.size + 'with' + client.users.size,
type: 'PLAYING',
}], status: 'idle' });
console.log('Ready!');
});
client.login(config.TOKEN);
follow at least one of my steps:
does ready event gets fired at all? put a breakpoint at client.user.setPresence, or a console.log above it
do a console.log(config.TOKEN)
Done not logging anything
then that's the problem. you're not logging in using a valid token
no token is correct
likely you're not setting the env variable TOKEN
Let me show you full code
const { Client, Intents } = require('discord.js');
const config = process.env;
const client = new Client({ intents: [Intents.FLAGS.GUILDS] });
client.on('ready', () => {
console.log('Ready!');
client.user.setPresence({ activities: [{
name: 'Oto in' + client.guilds.size + 'with' + client.users.size,
type: 'PLAYING',
}], status: 'idle' });
});
console.log(process.env['TOKEN'])
client.login(config.TOKEN);
const express = require('express');
const app = express();
const port = 3000;
app.use(express.static(__dirname));
app.listen(port);
if the line with console.log(process.env['TOKEN']) doesn't show anything, then your env variable TOKEN is empty
since it is empty, it is considered invalid
then why you said it does not log anything?
That's time it not logged
It looged after 5 sec
Is it possible that error is in intents
you are giving vague information, making the helping process harder
Sorry
what about now? does that specific line logs the token?
no, intents have nothing to do with logging in
Then I am using Correct Activity name what
i don't understand what that means.. Owjjsjsuwisoso is the token?
ah, ok. you have to know that the format of the token is incorrect, if it really looks similar to that
do you still get the invalid token error?
and bot is not online? (it can take some secs for the bot to come online)
Yes bot is not online
i guess not even console.log('Ready!'); shows anything
Yes it is also not showing
temporarily delete all express stuff (5 lines), and run the code again
Ok
const { Client, Intents } = require('discord.js');
const config = process.env;
const client = new Client({ intents: [Intents.FLAGS.GUILDS] });
client.on('ready', () => {
console.log('Ready!');
client.user.setPresence({ activities: [{
name: 'Oto in' + client.guilds.size + 'with' + client.users.size,
type: 'PLAYING',
}], status: 'idle' });
});
client.login(config.TOKEN);
///const express = require('express');
///const app = express();
///const port = 3000;
///app.use(express.static(__dirname));
///app.listen(port);
Done
Still not working
@tired yoke