GuildEmojiManager

export class GuildEmojiManager extends BaseGuildEmojiManager
export class GuildEmojiManager extends BaseGuildEmojiManager
Manages API methods for GuildEmojis and stores their cache.
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
guild:Guild
The guild this manager belongs to
Readonly
holds:Constructable<Holds>
The data structure belonging to this manager.
Inherited from DataManager
create(options):Promise<GuildEmoji>
Creates a new custom emoji in the guild.
Returns
The created emoji
Example
// Create a new emoji from a URL
guild.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
guild.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
guild.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
guild.emojis.create({ attachment: './memes/banana.png', name: 'banana' })
.then(emoji => console.log(`Created new emoji with name ${emoji.name}!`))
.catch(console.error);
NameTypeOptionalDescription
optionsGuildEmojiCreateOptionsNoOptions for creating the emoji
delete(emoji, reason?):Promise<void>
Deletes an emoji.
NameTypeOptionalDescription
emojiEmojiResolvableNoThe Emoji resolvable to delete
reasonstringYesReason for deleting the emoji
edit(emoji, options):Promise<GuildEmoji>
Edits an emoji.
NameTypeOptionalDescription
emojiEmojiResolvableNoThe Emoji resolvable to edit
optionsGuildEmojiEditOptionsNoThe options to provide
fetch(id, options?):Promise<GuildEmoji>
Obtains one or more emojis from Discord, or the emoji cache if they're already available.
Example
// Fetch all emojis from the guild
message.guild.emojis.fetch()
.then(emojis => console.log(`There are ${emojis.size} emojis.`))
.catch(console.error);
// Fetch all emojis from the guild
message.guild.emojis.fetch()
.then(emojis => console.log(`There are ${emojis.size} emojis.`))
.catch(console.error);
Example
// Fetch a single emoji
message.guild.emojis.fetch('222078108977594368')
.then(emoji => console.log(`The emoji name is: ${emoji.name}`))
.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);
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(emoji):GuildEmoji | null
Resolves an EmojiResolvable to an Emoji object.
NameTypeOptionalDescription
emojiEmojiResolvableNoThe Emoji resolvable to identify
Inherited from BaseGuildEmojiManager
resolveId(emoji):Snowflake | null
Resolves an EmojiResolvable to an Emoji id string.
NameTypeOptionalDescription
emojiEmojiResolvableNoThe Emoji resolvable to identify
Inherited from BaseGuildEmojiManager
resolveIdentifier(emoji):string | null
Resolves an EmojiResolvable to an emoji identifier.
Returns
NameTypeOptionalDescription
emojiEmojiIdentifierResolvableNoThe emoji resolvable to resolve
Inherited from BaseGuildEmojiManager
valueOf():Collection<Key, Holds>