Skip to content
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

refactor(Presences): remove from User, nullable on GuildMember #6055

Merged
merged 1 commit into from
Jul 5, 2021

Conversation

SpaceEEC
Copy link
Member

@SpaceEEC SpaceEEC commented Jul 5, 2021

as well as on Client#presenceUpdate

Please describe the changes this PR makes and why it should be merged:

This PR:

  • removes User#presence as it was a hack traversing the guild cache in order to find a presence of any member representing the given user.
  • makes GuildMember#presence nullable. That way you can distinguish between "This member is offline" and "The presence of this member is unknown" without having to check the cache yourself, rendering this getter pointless.
    Additionally this was confusing when you did not enable the presence intent in the first place: "Why do I know this member is offline? I am not supposed to know!" (Despite you actually having no idea)
  • makes Client#presenceUpdate first parameter null instead of undefined, because we don't do this in other places and an explicit null makes more sense than undefined.

Status and versioning classification:

  • Code changes have been tested against the Discord API, or there are no code changes
  • I know how to update typings and have done so, or typings don't need updating
  • This PR changes the library's interface (methods or parameters added)
  • This PR includes breaking changes (methods removed or renamed, parameters moved or removed)

@iCrawl iCrawl added this to the Version 13 milestone Jul 5, 2021
@iCrawl iCrawl requested review from kyranet and vladfrangu July 5, 2021 17:03
@iCrawl iCrawl merged commit afbd5db into discordjs:master Jul 5, 2021
@SpaceEEC SpaceEEC deleted the refactor/presences branch July 5, 2021 18:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants