mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-17 03:53:29 +01:00
feat(Guild): add disableInvites method (#8801)
* feat(GuildInviteManager): add setDisabled method * fix: formatting * refactor: move helper method to `Guild` * fix: rename method * fix: add newline before jsdoc * fix: remove disallowed trailing space * Update packages/discord.js/src/structures/Guild.js Co-authored-by: Hackerboi 69 <62872992+thehackerboi69github@users.noreply.github.com> Co-authored-by: Hackerboi 69 <62872992+thehackerboi69github@users.noreply.github.com> Co-authored-by: Aura Román <kyradiscord@gmail.com>
This commit is contained in:
@@ -1204,6 +1204,17 @@ class Guild extends AnonymousGuild {
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets whether this guild's invites are disabled.
|
||||
* @param {boolean} [disabled=true] Whether the invites are disabled
|
||||
* @returns {Promise<Guild>}
|
||||
*/
|
||||
async disableInvites(disabled = true) {
|
||||
const features = this.features.filter(feature => feature !== GuildFeature.InvitesDisabled);
|
||||
if (disabled) features.push(GuildFeature.InvitesDisabled);
|
||||
return this.edit({ features });
|
||||
}
|
||||
|
||||
/**
|
||||
* Whether this guild equals another guild. It compares all properties, so for most operations
|
||||
* it is advisable to just compare `guild.id === guild2.id` as it is much faster and is often
|
||||
|
||||
Reference in New Issue
Block a user