mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-11 17:13:31 +01:00
feat: general component improvements (#5787)
This commit is contained in:
@@ -267,6 +267,20 @@ class Util {
|
||||
return { animated: Boolean(m[1]), name: m[2], id: m[3] || null };
|
||||
}
|
||||
|
||||
/**
|
||||
* Resolves a partial emoji object from an {@link EmojiIdentifierResolvable}, without checking a Client.
|
||||
* @param {EmojiIdentifierResolvable} emoji Emoji identifier to resolve
|
||||
* @returns {?RawEmoji}
|
||||
* @private
|
||||
*/
|
||||
static resolvePartialEmoji(emoji) {
|
||||
if (!emoji) return null;
|
||||
if (typeof emoji === 'string') return /^\d{17,19}$/.test(emoji) ? { id: emoji } : Util.parseEmoji(emoji);
|
||||
const { id, name, animated } = emoji;
|
||||
if (!id && !name) return null;
|
||||
return { id, name, animated };
|
||||
}
|
||||
|
||||
/**
|
||||
* Shallow-copies an object with its class/prototype intact.
|
||||
* @param {Object} obj Object to clone
|
||||
|
||||
Reference in New Issue
Block a user