mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-15 02:53:31 +01:00
fix(MessageReaction*Action): correctly cache incoming members and users (#4969)
This commit is contained in:
@@ -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 {
|
||||||
|
|||||||
Reference in New Issue
Block a user