Skip to content

Commit

Permalink
feat(Guild): add INVITES_DISABLED feature support (#9051)
Browse files Browse the repository at this point in the history
* 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>
  • Loading branch information
jaw0r3k and Jiralite committed Feb 17, 2023
1 parent a7dc40f commit 69d71e9
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
12 changes: 12 additions & 0 deletions src/structures/Guild.js
Original file line number Diff line number Diff line change
Expand Up @@ -233,6 +233,7 @@ class Guild extends AnonymousGuild {
* * COMMUNITY
* * DISCOVERABLE
* * FEATURABLE
* * INVITES_DISABLED
* * INVITE_SPLASH
* * MEMBER_VERIFICATION_GATE_ENABLED
* * NEWS
Expand Down Expand Up @@ -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<Guild>}
*/
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<Guild>}
Expand Down
2 changes: 2 additions & 0 deletions typings/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1039,6 +1039,7 @@ export class Guild extends AnonymousGuild {
public fetchWidget(): Promise<Widget>;
public fetchWidgetSettings(): Promise<GuildWidgetSettings>;
public leave(): Promise<Guild>;
public disableInvites(disabled?: boolean): Promise<Guild>;
public setAFKChannel(afkChannel: VoiceChannelResolvable | null, reason?: string): Promise<Guild>;
public setAFKTimeout(afkTimeout: number, reason?: string): Promise<Guild>;
public setBanner(banner: BufferResolvable | Base64Resolvable | null, reason?: string): Promise<Guild>;
Expand Down Expand Up @@ -5365,6 +5366,7 @@ export type GuildFeatures =
| 'COMMUNITY'
| 'DISCOVERABLE'
| 'FEATURABLE'
| 'INVITES_DISABLED'
| 'INVITE_SPLASH'
| 'MEMBER_VERIFICATION_GATE_ENABLED'
| 'NEWS'
Expand Down

0 comments on commit 69d71e9

Please sign in to comment.