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

fix(MessageReaction*Action): correctly cache incoming members and users #4969

Merged
merged 1 commit into from
Nov 20, 2020

Conversation

SpaceEEC
Copy link
Member

@SpaceEEC SpaceEEC commented Nov 1, 2020

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

This PR fixes a bug involving partials around the messageReactionAdd event causing it to emit a partial user with an id with the value undefined, as well as caching incoming members and users from said event and typingStart.

The above mentioned bug was caused due to getUser being called with a raw user object, rather than an object with an user_id key, which it actually is expecting.

getUser(data) {
const id = data.user_id;
return data.user || this.getPayload({ id }, this.client.users, id, PartialTypes.USER);
}


MESSAGE_REACTION_ADD, as well as TYPING_START, emit a member and user, which now will be added to the cache, removing the requirement to enable the USER partial type for this event to work on previously uncached users.

If these are missing members and users (due to not originating from a guild), they will be passed long to getUser as before.

Those fields are documented, just not yet implemented by us, see here:
https://discord.com/developers/docs/topics/gateway#message-reaction-add-message-reaction-add-event-fields
https://discord.com/developers/docs/topics/gateway#typing-start-typing-start-event-fields

Status

  • 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

Semantic versioning classification:

  • This PR changes the library's interface (methods or parameters added)
    • This PR includes breaking changes (methods removed or renamed, parameters moved or removed)
  • This PR only includes non-code changes, like changes to documentation, README, etc.

bizojs added a commit to bizojs/Rada that referenced this pull request Nov 16, 2020
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.

5 participants