I'm trying to start my first discord bot. Installed NodeJS on my PC, started app in discord dev tools, make it bot, got token, selected priviliges, added bot to my server. Actually another bot i already have even sent welcome message saying my new bot joined the server. When i start it using command "node main.js" it says it went online, doesn't give any errors, however my bot isn't showing in members list (neither offline nor online) and it doesn't react to messages with its prefix. Here's my main.js code:
const Discord = require('discord.js');
const { Client, Intents } = require('discord.js');
const client = new Client({ intents: [Intents.FLAGS.GUILDS, Intents.FLAGS.GUILD_MESSAGES] });
const prefix = '=';
client.on('message', message => {
if (!message.content.startsWith(prefix) || message.author.bot) return;
const args = message.content.slice(prefix.length).split(/ +/);
const command = args.shift().toLowerCase();
if (command === 'status') {
console.log(command);
message.channel.send('Bot dziala poprawnie.');
}
} );
client.once('ready', () => {
console.log('GuruBot online');
});
client.login('my_token_is_here');```