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(Partials): Client#event:messageUpdate(oldMessage) and MessageReactionAdd on guild channels #3250

merged 3 commits into from May 7, 2019


None yet
5 participants
Copy link

commented May 6, 2019

This PR fixes #3248.
When a message gets updated, the MessageUpdate action handler was passing into Action.getMessage(...), if the developer has partials enabled for messages it will call MessageStore.add(...) which will call DataStore.add(...).

Here's where the issue happens; since the passed data will exist within the store as it's previously been cached and Message._patch exists it will end up calling the Message._patch(data) so = ? this.client.users.add(, !data.webhook_id) : null;

will set to null (as isn't being passed here) which will implicitly convert the message to a partial.

To fix this, Action.getPayload(...) has been added in this PR which will preemptively check the store and return the existing payload before calling *Store.add(...).
Action.getUser(data) has also been added in this PR so developers can make more use of the user partials and for completion with the other methods.

This PR also indirectly fixes #3247.
Within the handler for MessageReaction Action.getChannel(...) is called, the issue is that the guild doesn't also get passed along so the existing channel doesn't get returned and instead

const channel = Channel.create(this.client, data, guild);

will be called, since the data.type also wasn't passed Channel.create(...) would return undefined therefore, the messageReactionAdd event will never emit. The usage of Action.getPayload(...) will handle this in a similar manner.


  • 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.

Reseq64 approved these changes May 7, 2019

@amishshah amishshah merged commit 0dd3ed7 into discordjs:master May 7, 2019

1 check passed

continuous-integration/travis-ci/pr The Travis CI build passed

@izexi izexi deleted the izexi:partials-fix branch May 7, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.