backport: Guild#{fetchEmbed,setEmbed} (#2778)

*  backport: Guild Embeds

* fix: Added missing return

* docs: Updated typings
This commit is contained in:
Kyra
2018-08-28 17:33:51 +02:00
committed by Isabella
parent 3345c77ce2
commit 091b4fc214
3 changed files with 52 additions and 0 deletions

View File

@@ -59,6 +59,13 @@ class RESTMethods {
});
}
fetchEmbed(guildID) {
return this.rest.makeRequest('get', Endpoints.Guild(guildID).embed, true).then(data => ({
enabled: data.enabled,
channel: data.channel_id ? this.client.channels.get(data.channel_id) : null,
}));
}
sendMessage(channel, content, { tts, nonce, embed, disableEveryone, split, code, reply } = {}, files = null) {
return new Promise((resolve, reject) => { // eslint-disable-line complexity
if (typeof content !== 'undefined') content = this.client.resolver.resolveString(content);
@@ -853,6 +860,13 @@ class RESTMethods {
);
}
updateEmbed(guildID, embed, reason) {
return this.rest.makeRequest('patch', Endpoints.Guild(guildID).embed, true, {
enabled: embed.enabled,
channel_id: this.client.resolver.resolveChannelID(embed.channel),
}, undefined, reason);
}
setRolePositions(guildID, roles) {
return this.rest.makeRequest('patch', Endpoints.Guild(guildID).roles, true, roles).then(() =>
this.client.actions.GuildRolesPositionUpdate.handle({