From 69d71e967e12b83dd6d9accfb604cdd81d1aac09 Mon Sep 17 00:00:00 2001 From: Jaworek Date: Fri, 17 Feb 2023 22:45:10 +0100 Subject: [PATCH] feat(Guild): add `INVITES_DISABLED` feature support (#9051) * feat: disable invites * Update src/structures/Guild.js Co-authored-by: Jiralite <33201955+Jiralite@users.noreply.github.com> --------- Co-authored-by: Jiralite <33201955+Jiralite@users.noreply.github.com> --- src/structures/Guild.js | 12 ++++++++++++ typings/index.d.ts | 2 ++ 2 files changed, 14 insertions(+) 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'