mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-12 17:43:30 +01:00
backport: Guild#{fetchEmbed,setEmbed} (#2778)
* backport: Guild Embeds * fix: Added missing return * docs: Updated typings
This commit is contained in:
@@ -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({
|
||||
|
||||
Reference in New Issue
Block a user