mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-12 01:23:31 +01:00
Add support to edit emojis (#1142)
* Add support to edit emojis * Fixes for coding style. * Add and use guildEmoji constants for updateEmoji * Just use the Constant * Fix typo in edit documentation * Specify property types * Fix ridiculous typo. * Update Emoji.js
This commit is contained in:
@@ -101,6 +101,27 @@ class Emoji {
|
||||
return encodeURIComponent(this.name);
|
||||
}
|
||||
|
||||
/**
|
||||
* Data for editing an emoji
|
||||
* @typedef {Object} EmojiEditData
|
||||
* @property {string} [name] The name of the emoji
|
||||
* @property {Collection<string, Role>|Array<string|Role>} [roles] Roles to restrict emoji to
|
||||
*/
|
||||
|
||||
/**
|
||||
* Edits the emoji
|
||||
* @param {EmojiEditData} data The new data for the emoji
|
||||
* @returns {Promise<Emoji>}
|
||||
* @example
|
||||
* // edit a emoji
|
||||
* emoji.edit({name: 'newemoji'})
|
||||
* .then(e => console.log(`Edited emoji ${e}`))
|
||||
* .catch(console.error);
|
||||
*/
|
||||
edit(data) {
|
||||
return this.client.rest.methods.updateEmoji(this, data);
|
||||
}
|
||||
|
||||
/**
|
||||
* When concatenated with a string, this automatically returns the emoji mention rather than the object.
|
||||
* @returns {string}
|
||||
|
||||
Reference in New Issue
Block a user