D
D
dollar2021-10-23 08:57:03
JavaScript
dollar, 2021-10-23 08:57:03

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') //не выводит ничего при смене статуса
})

The event doesn't fire.

PS The rest works.
bot.on('ready', () => { 
  console.log("it's working"); //выводит нормально
});

Answer the question

In order to leave comments, you need to log in

2 answer(s)
D
dollar, 2021-10-24
@dollar

It turns out that everything is in order with the code. It was necessary to enable some permissions in the bot settings .
6174e076caf84721934191.png

A
Alexander, 2021-10-24
@Aleksandr-JS-Developer

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 question

Ask a Question

731 491 924 answers to any question