ApplicationEmojiManager

export class ApplicationEmojiManager extends CachedManager<Snowflake, ApplicationEmoji, EmojiResolvable>
export class ApplicationEmojiManager extends CachedManager<Snowflake, ApplicationEmoji, EmojiResolvable>
Manages API methods for ApplicationEmojis and stores their cache.
application:ClientApplication
The application this manager belongs to
Readonly
cache:Collection<Key, Holds>
The cache of items for this manager.
Inherited from DataManager
Readonly
client:Client
The client that instantiated this Manager
Inherited from BaseManager
Readonly
holds:Constructable<Holds>
The data structure belonging to this manager.
Inherited from DataManager
create(options):Promise<ApplicationEmoji>
Creates a new custom emoji of the application.
Returns
The created emoji
Example
// Create a new emoji from a URL
application.emojis.create({ attachment: 'https://i.imgur.com/w3duR07.png', name: 'rip' })
.then(emoji => console.log(`Created new emoji with name ${emoji.name}!`))
.catch(console.error);
// Create a new emoji from a URL
application.emojis.create({ attachment: 'https://i.imgur.com/w3duR07.png', name: 'rip' })
.then(emoji => console.log(`Created new emoji with name ${emoji.name}!`))
.catch(console.error);
Example
// Create a new emoji from a file on your computer
application.emojis.create({ attachment: './memes/banana.png', name: 'banana' })
.then(emoji => console.log(`Created new emoji with name ${emoji.name}!`))
.catch(console.error);
// Create a new emoji from a file on your computer
application.emojis.create({ attachment: './memes/banana.png', name: 'banana' })
.then(emoji => console.log(`Created new emoji with name ${emoji.name}!`))
.catch(console.error);
NameTypeOptionalDescription
optionsApplicationEmojiCreateOptionsNoOptions for creating the emoji
delete(emoji):Promise<void>
Deletes an emoji.
NameTypeOptionalDescription
emojiEmojiResolvableNoThe Emoji resolvable to delete
edit(emoji, options):Promise<ApplicationEmoji>
Edits an emoji.
NameTypeOptionalDescription
emojiEmojiResolvableNoThe Emoji resolvable to edit
optionsApplicationEmojiEditOptionsNoThe options to provide
fetch(id, options?):Promise<ApplicationEmoji>
Obtains one or more emojis from Discord, or the emoji cache if they're already available.
Example
// Fetch all emojis from the application
application.emojis.fetch()
.then(emojis => console.log(`There are ${emojis.size} emojis.`))
.catch(console.error);
// Fetch all emojis from the application
application.emojis.fetch()
.then(emojis => console.log(`There are ${emojis.size} emojis.`))
.catch(console.error);
Example
// Fetch a single emoji
application.emojis.fetch('222078108977594368')
.then(emoji => console.log(`The emoji name is: ${emoji.name}`))
.catch(console.error);
// Fetch a single emoji
application.emojis.fetch('222078108977594368')
.then(emoji => console.log(`The emoji name is: ${emoji.name}`))
.catch(console.error);
NameTypeOptionalDescription
idSnowflakeNoThe emoji's id
optionsBaseFetchOptionsYesAdditional options for this fetch
fetchAuthor(emoji):Promise<User>
Fetches the author for this emoji
NameTypeOptionalDescription
emojiEmojiResolvableNoThe emoji to fetch the author of
resolve(idOrInstance):Holds
Resolves a data entry to a data Object.
Returns
An instance from this Manager
NameTypeOptionalDescription
idOrInstanceHoldsNoThe id or instance of something in this Manager
resolveId(idOrInstance):Key
Resolves a data entry to an instance id.
Returns
NameTypeOptionalDescription
idOrInstanceKey | HoldsNoThe id or instance of something in this Manager
valueOf():Collection<Key, Holds>