diff --git a/src/structures/Guild.js b/src/structures/Guild.js index 73396a6cc..dae49af6a 100644 --- a/src/structures/Guild.js +++ b/src/structures/Guild.js @@ -233,6 +233,7 @@ class Guild extends AnonymousGuild { * * COMMUNITY * * DISCOVERABLE * * FEATURABLE + * * INVITES_DISABLED * * INVITE_SPLASH * * MEMBER_VERIFICATION_GATE_ENABLED * * NEWS @@ -1317,6 +1318,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} + */ + disableInvites(disabled = true) { + const features = this.features.filter(feature => feature !== 'INVITES_DISABLED'); + if (disabled) features.push('INVITES_DISABLED'); + return this.edit({ features }); + } + /** * Leaves the guild. * @returns {Promise} diff --git a/typings/index.d.ts b/typings/index.d.ts index 1592763ac..c1eb3ba7f 100644 --- a/typings/index.d.ts +++ b/typings/index.d.ts @@ -1039,6 +1039,7 @@ export class Guild extends AnonymousGuild { public fetchWidget(): Promise; public fetchWidgetSettings(): Promise; public leave(): Promise; + public disableInvites(disabled?: boolean): Promise; public setAFKChannel(afkChannel: VoiceChannelResolvable | null, reason?: string): Promise; public setAFKTimeout(afkTimeout: number, reason?: string): Promise; public setBanner(banner: BufferResolvable | Base64Resolvable | null, reason?: string): Promise; @@ -5365,6 +5366,7 @@ export type GuildFeatures = | 'COMMUNITY' | 'DISCOVERABLE' | 'FEATURABLE' + | 'INVITES_DISABLED' | 'INVITE_SPLASH' | 'MEMBER_VERIFICATION_GATE_ENABLED' | 'NEWS'