discord / discord-api-docs

Official Discord API Documentation
https://discord.com/developers/docs/intro
Other
5.93k stars 1.25k forks source link

[Feature Request] Be able to subscribe to individual events instead of all events listed in a group. #1691

Closed GarbearSheer closed 3 years ago

GarbearSheer commented 4 years ago

The intents are listed on the Discord docs as such:

GUILD_MEMBERS (1 << 1)
  - GUILD_MEMBER_ADD
  - GUILD_MEMBER_UPDATE
  - GUILD_MEMBER_REMOVE

https://discord.com/developers/docs/topics/gateway#gateway-intents

To clarify what I am suggesting, I am suggesting that we should be able to subscribe to something like GUILD_MEMBER_ADD, but not GUILD_MEMBER_UPDATE instead of all three of the events listed above.

The intents are already very beneficial for improving performance, but if it were possible to subscribe to those individual events, I feel it would maximise performance.

Edit: I was corrected by advaith#9121 and I now correctly identify the events as events, instead of "sub-intents" I appreciate that, thank you.

muddyfish commented 4 years ago

This would be pretty helpful for me, as I don't ever need to check message updates but they're the 2nd most common type of event I get from the gateway (about 40 per second on my bot)

ziad8727 commented 4 years ago

maybe a system similar to how you can subscribe to events with RPC or just use bitwise operators like existing intents.. dunno

andersfylling commented 4 years ago

It is more intuitive to subscribe to specific events rather than these intents. Given the number of events can each reserve a bit position (bit flag) in a 64 bit integer with room to double (?) the number of events, it would be great to see that change in v7.

However, the current set of events does not separate "direct message" related events from "guild related" events. If I were to make a change here, I would simply give the "direct message" events different bit flags from the "guild related" events, just for clarity.

This would also allow event packets to exclude the event name string (eg. "MESSAGE_REACTION_REMOVE_ALL") and just use the respective bit flag instead.

night commented 3 years ago

We have no current plans to make it possible to subscribe to individual events. Groups of events allow us to classify events for use cases rather than forcing developers to decide what they must listen to, including events needed for guilds vs dm and restricted/noisy event groups.