mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-16 03:23:29 +01:00
docs: Remove duplicate APIEmoji (#9880)
* types: remove duplicate type definition * chore: add `Emoji` to method * types(resolvePartialEmoji): overload method
This commit is contained in:
@@ -3,14 +3,6 @@
|
||||
const { DiscordSnowflake } = require('@sapphire/snowflake');
|
||||
const Base = require('./Base');
|
||||
|
||||
/**
|
||||
* Represents raw emoji data from the API
|
||||
* @typedef {APIEmoji} RawEmoji
|
||||
* @property {?Snowflake} id The emoji's id
|
||||
* @property {?string} name The emoji's name
|
||||
* @property {?boolean} animated Whether the emoji is animated
|
||||
*/
|
||||
|
||||
/**
|
||||
* Represents an emoji, see {@link GuildEmoji} and {@link ReactionEmoji}.
|
||||
* @extends {Base}
|
||||
@@ -101,8 +93,3 @@ class Emoji extends Base {
|
||||
}
|
||||
|
||||
exports.Emoji = Emoji;
|
||||
|
||||
/**
|
||||
* @external APIEmoji
|
||||
* @see {@link https://discord.com/developers/docs/resources/emoji#emoji-object}
|
||||
*/
|
||||
|
||||
@@ -79,13 +79,21 @@ async function fetchRecommendedShardCount(token, { guildsPerShard = 1_000, multi
|
||||
return Math.ceil((shards * (1_000 / guildsPerShard)) / multipleOf) * multipleOf;
|
||||
}
|
||||
|
||||
/**
|
||||
* A partial emoji object.
|
||||
* @typedef {Object} PartialEmoji
|
||||
* @property {boolean} animated Whether the emoji is animated
|
||||
* @property {Snowflake|undefined} id The id of the emoji
|
||||
* @property {string} name The name of the emoji
|
||||
*/
|
||||
|
||||
/**
|
||||
* Parses emoji info out of a string. The string must be one of:
|
||||
* * A UTF-8 emoji (no id)
|
||||
* * A URL-encoded UTF-8 emoji (no id)
|
||||
* * A Discord custom emoji (`<:name:id>` or `<a:name:id>`)
|
||||
* @param {string} text Emoji string to parse
|
||||
* @returns {APIEmoji} Object with `animated`, `name`, and `id` properties
|
||||
* @returns {?PartialEmoji}
|
||||
*/
|
||||
function parseEmoji(text) {
|
||||
if (text.includes('%')) text = decodeURIComponent(text);
|
||||
@@ -94,10 +102,16 @@ function parseEmoji(text) {
|
||||
return match && { animated: Boolean(match[1]), name: match[2], id: match[3] };
|
||||
}
|
||||
|
||||
/**
|
||||
* A partial emoji object with only an id.
|
||||
* @typedef {Object} PartialEmojiOnlyId
|
||||
* @property {Snowflake} id The id of the emoji
|
||||
*/
|
||||
|
||||
/**
|
||||
* Resolves a partial emoji object from an {@link EmojiIdentifierResolvable}, without checking a Client.
|
||||
* @param {EmojiIdentifierResolvable} emoji Emoji identifier to resolve
|
||||
* @returns {?RawEmoji}
|
||||
* @param {Emoji|EmojiIdentifierResolvable} emoji Emoji identifier to resolve
|
||||
* @returns {?(PartialEmoji|PartialEmojiOnlyId)} Suppling a snowflake yields `PartialEmojiOnlyId`.
|
||||
* @private
|
||||
*/
|
||||
function resolvePartialEmoji(emoji) {
|
||||
|
||||
Reference in New Issue
Block a user