mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-12 01:23:31 +01:00
backport: Guild#{fetchEmbed,setEmbed} (#2778)
* backport: Guild Embeds * fix: Added missing return * docs: Updated typings
This commit is contained in:
@@ -530,6 +530,26 @@ class Guild {
|
||||
return this.client.rest.methods.fetchVoiceRegions(this.id);
|
||||
}
|
||||
|
||||
/**
|
||||
* The Guild Embed object
|
||||
* @typedef {Object} GuildEmbedData
|
||||
* @property {boolean} enabled Whether the embed is enabled
|
||||
* @property {?ChannelResolvable} channel The embed channel
|
||||
*/
|
||||
|
||||
/**
|
||||
* Fetches the guild embed.
|
||||
* @returns {Promise<GuildEmbedData>}
|
||||
* @example
|
||||
* // Fetches the guild embed
|
||||
* guild.fetchEmbed()
|
||||
* .then(embed => console.log(`The embed is ${embed.enabled ? 'enabled' : 'disabled'}`))
|
||||
* .catch(console.error);
|
||||
*/
|
||||
fetchEmbed() {
|
||||
return this.client.rest.methods.fetchEmbed(this.id);
|
||||
}
|
||||
|
||||
/**
|
||||
* Fetch audit logs for this guild.
|
||||
* @param {Object} [options={}] Options for fetching audit logs
|
||||
@@ -1025,6 +1045,17 @@ class Guild {
|
||||
return this.client.rest.methods.updateChannelPositions(this.id, channelPositions);
|
||||
}
|
||||
|
||||
/**
|
||||
* Edits the guild's embed.
|
||||
* @param {GuildEmbedData} embed The embed for the guild
|
||||
* @param {string} [reason] Reason for changing the guild's embed
|
||||
* @returns {Promise<Guild>}
|
||||
*/
|
||||
setEmbed(embed, reason) {
|
||||
return this.client.rest.methods.updateEmbed(this.id, embed, reason)
|
||||
.then(() => this);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a new role in the guild with given information.
|
||||
* @param {RoleData} [data] The data to update the role with
|
||||
|
||||
Reference in New Issue
Block a user