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): Use more user objects available from the gateway #4791

Merged
merged 7 commits into from
Sep 13, 2020
Merged
8 changes: 3 additions & 5 deletions src/client/actions/Action.js
Original file line number Diff line number Diff line change
Expand Up @@ -81,15 +81,13 @@ class GenericAction {
}

getMember(data, guild) {
const id = data.user.id;
const user = data.user;
return this.getPayload(
{
user: {
id,
},
user,
},
guild.members,
id,
user.id,
PartialTypes.GUILD_MEMBER,
);
}
Expand Down
2 changes: 1 addition & 1 deletion src/client/actions/MessageReactionAdd.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ class MessageReactionAdd extends Action {
handle(data) {
if (!data.emoji) return false;

const user = this.getUser(data);
const user = data.member ? this.client.users.add(data.member.user) : this.getUser(data);
wasdennnoch marked this conversation as resolved.
Show resolved Hide resolved
if (!user) return false;

// Verify channel
Expand Down
2 changes: 1 addition & 1 deletion src/client/websocket/handlers/TYPING_START.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ const textBasedChannelTypes = ['dm', 'text', 'news'];

module.exports = (client, { d: data }) => {
const channel = client.channels.cache.get(data.channel_id);
const user = client.users.cache.get(data.user_id);
const user = data.member ? client.users.add(data.member.user) : client.users.cache.get(data.user_id);
const timestamp = new Date(data.timestamp * 1000);

if (channel && user) {
Expand Down