Answer the question
In order to leave comments, you need to log in
Which event in discord.js is responsible for changing the status of users?
Tried like this:
const Discord = require('discord.js');
const bot = new Discord.Client();
bot.on('presenceUpdate', (oldMember, newMember) => {
console.log('test') //не выводит ничего при смене статуса
})
bot.on('ready', () => {
console.log("it's working"); //выводит нормально
});
Answer the question
In order to leave comments, you need to log in
It turns out that everything is in order with the code. It was necessary to enable some permissions in the bot settings .
On the site, the initialization is different from yours. Have you tried launching from the website?
const { Client, Intents } = require('discord.js');
const client = new Client({ intents: [Intents.FLAGS.GUILDS] });
client.on('ready', () => {
console.log(`Logged in as ${client.user.tag}!`);
});
client.on('interactionCreate', async interaction => {
if (!interaction.isCommand()) return;
if (interaction.commandName === 'ping') {
await interaction.reply('Pong!');
}
});
client.login('token');
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question