Add role support to emoji creation (#1141)

* add role support to emojis

* specify types
This commit is contained in:
Gus Caplan
2017-01-30 21:47:27 -06:00
committed by Schuyler Cebulskie
parent 18729b25c7
commit 565c640bc6
2 changed files with 9 additions and 6 deletions

View File

@@ -559,9 +559,11 @@ class RESTMethods {
.then(data => data.pruned);
}
createEmoji(guild, image, name) {
return this.rest.makeRequest('post', `${Constants.Endpoints.guildEmojis(guild.id)}`, true, { name, image })
.then(data => this.client.actions.GuildEmojiCreate.handle(data, guild).emoji);
createEmoji(guild, image, name, roles) {
const data = { image, name };
if (roles) data.roles = roles.map(r => r.id ? r.id : r);
return this.rest.makeRequest('post', `${Constants.Endpoints.guildEmojis(guild.id)}`, true, data)
.then(emoji => this.client.actions.GuildEmojiCreate.handle(emoji, guild).emoji);
}
updateEmoji(emoji, _data) {