timotejroiko / discord.js-light

All the power of discord.js, zero caching. This library modifies discord.js's internal classes and functions in order to give you full control over its caching behaviour.
Apache License 2.0
292 stars 29 forks source link

Privileged Intents Support #66

Closed yakuroot closed 3 years ago

yakuroot commented 3 years ago

Private Intents does not work on commit "7c753b9d6a59ed149464d14415123772fa9e49ab". I wrote the code like this.

const client = new Client({
  intents: [Intents.FLAGS.GUILD_MESSAGES, Intents.PRIVILEGED],
});

client.on("message", (msg) => {
  if (msg.author.bot) return;
  console.log(msg.author.presence.status);
});

However, only offline appears in the console log.

Also, it doesn't seem to work in the official release of v3.5.11. This code was created when using the above version, and will only output offline to the console log.

const client = new Client({
  ws: {
    intents: [Intents.FLAGS.GUILD_MESSAGES, Intents.PRIVILEGED],
  },
});

client.on("message", (msg) => {
  if (msg.author.bot) return;
  console.log(msg.author.presence.status);
});
timotejroiko commented 3 years ago

They should work, if you console.log(client.options.intents) you should see the correct value and you should receive presenceUpdate events.

The problem is that presences are not cached by default, you need to set cachePresences:true in your client options to use them in a message event in discord.js-light

yakuroot commented 3 years ago

Thank you. It's been resolved.