mirror of
https://github.com/danbulant/discord.js
synced 2026-07-05 19:20:42 +00:00
fix(MessageReaction*Action): correctly cache incoming members and users (#4969)
This commit is contained in:
parent
7faa73a561
commit
8b91ac5d7e
3 changed files with 9 additions and 4 deletions
|
|
@ -93,8 +93,9 @@ class GenericAction {
|
||||||
if (data.guild_id && data.member && data.member.user) {
|
if (data.guild_id && data.member && data.member.user) {
|
||||||
const guild = this.client.guilds.cache.get(data.guild_id);
|
const guild = this.client.guilds.cache.get(data.guild_id);
|
||||||
if (guild) {
|
if (guild) {
|
||||||
const member = this.getMember(data.member, guild);
|
return guild.members.add(data.member).user;
|
||||||
return member ? member.user : this.getUser(data.member.user);
|
} else {
|
||||||
|
return this.client.users.add(data.member.user);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return this.getUser(data);
|
return this.getUser(data);
|
||||||
|
|
|
||||||
|
|
@ -8,7 +8,10 @@ const { PartialTypes } = require('../../util/Constants');
|
||||||
{ user_id: 'id',
|
{ user_id: 'id',
|
||||||
message_id: 'id',
|
message_id: 'id',
|
||||||
emoji: { name: '<27>', id: null },
|
emoji: { name: '<27>', id: null },
|
||||||
channel_id: 'id' } }
|
channel_id: 'id',
|
||||||
|
// If originating from a guild
|
||||||
|
guild_id: 'id',
|
||||||
|
member: { ..., user: { ... } } }
|
||||||
*/
|
*/
|
||||||
|
|
||||||
class MessageReactionAdd extends Action {
|
class MessageReactionAdd extends Action {
|
||||||
|
|
|
||||||
|
|
@ -7,7 +7,8 @@ const { Events } = require('../../util/Constants');
|
||||||
{ user_id: 'id',
|
{ user_id: 'id',
|
||||||
message_id: 'id',
|
message_id: 'id',
|
||||||
emoji: { name: '<27>', id: null },
|
emoji: { name: '<27>', id: null },
|
||||||
channel_id: 'id' } }
|
channel_id: 'id',
|
||||||
|
guild_id: 'id' }
|
||||||
*/
|
*/
|
||||||
|
|
||||||
class MessageReactionRemove extends Action {
|
class MessageReactionRemove extends Action {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue