mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-11 00:53:31 +01:00
Clean up reactions, add remove all reactions (#890)
* Clean up reactions, add remove all reactions * Reorganize reactions * Re-add Gawdl3y's precious little inline * Update Message.js
This commit is contained in:
committed by
Schuyler Cebulskie
parent
a359f344d8
commit
5ed8098af8
@@ -8,6 +8,8 @@ const Message = require(`../structures/Message`);
|
||||
const Guild = require(`../structures/Guild`);
|
||||
const Channel = require(`../structures/Channel`);
|
||||
const GuildMember = require(`../structures/GuildMember`);
|
||||
const Emoji = require(`../structures/Emoji`);
|
||||
const ReactionEmoji = require(`../structures/ReactionEmoji`);
|
||||
|
||||
/**
|
||||
* The DataResolver identifies different objects and tries to resolve a specific piece of information from them, e.g.
|
||||
@@ -264,6 +266,27 @@ class ClientDataResolver {
|
||||
|
||||
return Promise.reject(new TypeError('The resource must be a string or Buffer.'));
|
||||
}
|
||||
|
||||
/**
|
||||
* Data that can be resolved to give an emoji identifier. This can be:
|
||||
* * A string
|
||||
* * An Emoji
|
||||
* * A ReactionEmoji
|
||||
* @typedef {string|Emoji|ReactionEmoji} EmojiIdentifierResolvable
|
||||
*/
|
||||
|
||||
/**
|
||||
* Resolves an EmojiResolvable to an emoji identifier
|
||||
* @param {EmojiIdentifierResolvable} emoji The emoji resolvable to resolve
|
||||
* @returns {string}
|
||||
*/
|
||||
resolveEmojiIdentifier(emoji) {
|
||||
if (emoji instanceof Emoji || emoji instanceof ReactionEmoji) return emoji.identifier;
|
||||
if (typeof emoji === 'string') {
|
||||
if (!emoji.includes('%')) return encodeURIComponent(emoji);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = ClientDataResolver;
|
||||
|
||||
Reference in New Issue
Block a user