-
-
Notifications
You must be signed in to change notification settings - Fork 3.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Feature - Raw Presence Updates #10048
base: master
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I actually needed this feature. Thanks.
def _create_activities(self, data: PartialPresenceUpdate, state: ConnectionState) -> None: | ||
self._activities = tuple(create_activity(d, state) for d in data['activities']) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think this should be done outside of __init__
, as it'll be called on every RawPresenceUpdate
anyway since you either dispatch raw_presence_update
, call Member._presence_update
, or even do both.
Summary
A current limitation of the library is not being able to listen to presence updates without meeting certain requirements, namely needing both member intents and a member and guild cache. In cases where these requirements are not available or desired, presence updates are still received and discarded. This PR adds functionality for the
on_raw_presence_update
event, which allows anyone not subscribed to member intents or not using a member or guild cache to receive presence update events.Currently the implementation is semi opt-in, allowing anyone to manually enable or disable raw presences via the new
Client
keyword parameter. By default this event is only enabled automatically when a user haspresences
intents enabled andmembers
intents disabled, as this would mean they could not receive the currently availableon_presence_update
event.Added
on_raw_presence_update
RawPresenceUpdateEvent
model received in the event and used inMember
to update presence data.Client(enable_raw_presences=...)
keyword argument.ClientStatus
- Previously a private internal. The model representing Client Status data from discord.Member.client_status
- Previously a private internal.Checklist