GuildEmojiManager
classe · Source
Manages API methods for GuildEmojis and stores their cache.
Extends: BaseGuildEmojiManager
Properties
guild
The guild this manager belongs to Source
cache
The cache of GuildEmojis Source
_cache
The private cache of items for this manager. Source
holds
The data structure belonging to this manager. Source
client
The client that instantiated this Manager Source
Methods
create
Creates a new custom emoji in the guild. Parameters
| Name | Type | Description |
|---|---|---|
attachment | BufferResolvable | Base64Resolvable | The image for the emoji |
name | string | The name for the emoji |
options? | GuildEmojiCreateOptions | Options for creating the emoji |
Returns: Promise<Emoji> — The created emoji
// Create a new emoji from a URL
guild.emojis.create('https://i.imgur.com/w3duR07.png', 'rip')
.then(emoji => console.log(`Created new emoji with name ${emoji.name}!`))
.catch(console.error);// Create a new emoji from a file on your computer
guild.emojis.create('./memes/banana.png', 'banana')
.then(emoji => console.log(`Created new emoji with name ${emoji.name}!`))
.catch(console.error);fetch
Obtains one or more emojis from Discord, or the emoji cache if they're already available. Parameters
| Name | Type | Description |
|---|---|---|
id? | Snowflake | The emoji's id |
options? | BaseFetchOptions | Additional options for this fetch |
Returns: Promise<(GuildEmoji\|Collection<Snowflake, GuildEmoji>)>
// Fetch all emojis from the guild
message.guild.emojis.fetch()
.then(emojis => console.log(`There are ${emojis.size} emojis.`))
.catch(console.error);// Fetch a single emoji
message.guild.emojis.fetch('222078108977594368')
.then(emoji => console.log(`The emoji name is: ${emoji.name}`))
.catch(console.error);delete
Deletes an emoji. Parameters
| Name | Type | Description |
|---|---|---|
emoji | EmojiResolvable | The Emoji resolvable to delete |
reason? | string | Reason for deleting the emoji |
Returns: Promise<void>Source
edit
Edits an emoji. Parameters
| Name | Type | Description |
|---|---|---|
emoji | EmojiResolvable | The Emoji resolvable to edit |
data | GuildEmojiEditData | The new data for the emoji |
reason? | string | Reason for editing this emoji |
Returns: Promise<GuildEmoji>Source
fetchAuthor
Fetches the author for this emoji Parameters
| Name | Type | Description |
|---|---|---|
emoji | EmojiResolvable | The emoji to fetch the author of |
Returns: Promise<User>Source
resolve
Resolves an EmojiResolvable to an Emoji object. Parameters
| Name | Type | Description |
|---|---|---|
emoji | EmojiResolvable | The Emoji resolvable to identify |
Returns: GuildEmojiSource
resolveId
Resolves an EmojiResolvable to an Emoji id string. Parameters
| Name | Type | Description |
|---|---|---|
emoji | EmojiResolvable | The Emoji resolvable to identify |
Returns: SnowflakeSource
resolveIdentifier
Resolves an EmojiResolvable to an emoji identifier. Parameters
| Name | Type | Description |
|---|---|---|
emoji | EmojiIdentifierResolvable | The emoji resolvable to resolve |
Returns: stringSource