mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-11 09:03:29 +01:00
feat(Partials): add DMChannel/MessageReaction#fetch() and Parti… (#3261)
* add DMChannel#fetch() & Action#getChannel({recipients})
* ref for MessageReaction partial
* typings
* add PartialTypes.REACTION
* accommodate for fully removed reactions
* fix incorrect wording and typo
* typings: MessageReaction#count is nullable
* typings: mark MessageReaction#partial as readonly
Co-Authored-By: Vlad Frangu <kingdgrizzle@gmail.com>
* fix(User): fetch dm channel if cached one is partial
* docs: add missing comma
Co-Authored-By: Antonio Román <kyradiscord@gmail.com>
This commit is contained in:
@@ -36,6 +36,7 @@ class GenericAction {
|
||||
return data.channel || this.getPayload({
|
||||
id,
|
||||
guild_id: data.guild_id,
|
||||
recipients: [data.author || { id: data.user_id }],
|
||||
}, this.client.channels, id, PartialTypes.CHANNEL);
|
||||
}
|
||||
|
||||
@@ -52,9 +53,9 @@ class GenericAction {
|
||||
const id = data.emoji.id || decodeURIComponent(data.emoji.name);
|
||||
return this.getPayload({
|
||||
emoji: data.emoji,
|
||||
count: 0,
|
||||
count: message.partial ? null : 0,
|
||||
me: user.id === this.client.user.id,
|
||||
}, message.reactions, id, PartialTypes.MESSAGE);
|
||||
}, message.reactions, id, PartialTypes.REACTION);
|
||||
}
|
||||
|
||||
getMember(data, guild) {
|
||||
|
||||
@@ -26,11 +26,8 @@ class MessageReactionAdd extends Action {
|
||||
if (!message) return false;
|
||||
|
||||
// Verify reaction
|
||||
const reaction = message.reactions.add({
|
||||
emoji: data.emoji,
|
||||
count: 0,
|
||||
me: user.id === this.client.user.id,
|
||||
});
|
||||
const reaction = this.getReaction(data, message, user);
|
||||
if (!reaction) return false;
|
||||
reaction._add(user);
|
||||
/**
|
||||
* Emitted whenever a reaction is added to a cached message.
|
||||
|
||||
Reference in New Issue
Block a user