mirror of
https://github.com/danbulant/discord.js
synced 2026-06-20 07:02:00 +00:00
Webpack build for branch master: 18729b25c7
This commit is contained in:
parent
fe5fb77d68
commit
d95ccbde90
2 changed files with 40 additions and 6 deletions
|
|
@ -197,6 +197,7 @@ const Endpoints = exports.Endpoints = {
|
|||
guildMemberNickname: (guildID) => `${Endpoints.guildMember(guildID, '@me')}/nick`,
|
||||
guildChannels: (guildID) => `${Endpoints.guild(guildID)}/channels`,
|
||||
guildEmojis: (guildID) => `${Endpoints.guild(guildID)}/emojis`,
|
||||
guildEmoji: (guildID, emojiID) => `${Endpoints.guildEmojis(guildID)}/${emojiID}`,
|
||||
guildSearch: (guildID) => `${Endpoints.guild(guildID)}/messages/search`,
|
||||
guildVoiceRegions: (guildID) => `${Endpoints.guild(guildID)}/regions`,
|
||||
|
||||
|
|
@ -1931,6 +1932,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}
|
||||
|
|
@ -21248,6 +21270,7 @@ class ClientDataManager {
|
|||
const oldEmoji = cloneObject(currentEmoji);
|
||||
currentEmoji.setup(newData);
|
||||
this.client.emit(Constants.Events.GUILD_EMOJI_UPDATE, oldEmoji, currentEmoji);
|
||||
return currentEmoji;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -21604,7 +21627,10 @@ const Action = __webpack_require__(2);
|
|||
|
||||
class GuildEmojiUpdateAction extends Action {
|
||||
handle(oldEmoji, newEmoji) {
|
||||
this.client.dataManager.updateEmoji(oldEmoji, newEmoji);
|
||||
const emoji = this.client.dataManager.updateEmoji(oldEmoji, newEmoji);
|
||||
return {
|
||||
emoji,
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -22965,6 +22991,14 @@ class RESTMethods {
|
|||
.then(data => this.client.actions.GuildEmojiCreate.handle(data, guild).emoji);
|
||||
}
|
||||
|
||||
updateEmoji(emoji, _data) {
|
||||
const data = {};
|
||||
if (_data.name) data.name = _data.name;
|
||||
if (_data.roles) data.roles = _data.roles.map(r => r.id ? r.id : r);
|
||||
return this.rest.makeRequest('patch', Constants.Endpoints.guildEmoji(emoji.guild.id, emoji.id), true, data)
|
||||
.then(newEmoji => this.client.actions.GuildEmojiUpdate.handle(emoji, newEmoji).emoji);
|
||||
}
|
||||
|
||||
deleteEmoji(emoji) {
|
||||
return this.rest.makeRequest('delete', `${Constants.Endpoints.guildEmojis(emoji.guild.id)}/${emoji.id}`, true)
|
||||
.then(() => this.client.actions.GuildEmojiDelete.handle(emoji).data);
|
||||
|
|
|
|||
10
discord.master.min.js
vendored
10
discord.master.min.js
vendored
File diff suppressed because one or more lines are too long
Loading…
Reference in a new issue