Skip to content

Commit 45faa19

Browse files
MrMythicalYTmanuelvleeuwenkyranet
authored
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 <[email protected]> Co-authored-by: Hackerboi 69 <[email protected]> Co-authored-by: Aura Román <[email protected]>
1 parent 8f552a0 commit 45faa19

File tree

2 files changed

+12
-0
lines changed

2 files changed

+12
-0
lines changed

packages/discord.js/src/structures/Guild.js

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1204,6 +1204,17 @@ class Guild extends AnonymousGuild {
12041204
return this;
12051205
}
12061206

1207+
/**
1208+
* Sets whether this guild's invites are disabled.
1209+
* @param {boolean} [disabled=true] Whether the invites are disabled
1210+
* @returns {Promise<Guild>}
1211+
*/
1212+
async disableInvites(disabled = true) {
1213+
const features = this.features.filter(feature => feature !== GuildFeature.InvitesDisabled);
1214+
if (disabled) features.push(GuildFeature.InvitesDisabled);
1215+
return this.edit({ features });
1216+
}
1217+
12071218
/**
12081219
* Whether this guild equals another guild. It compares all properties, so for most operations
12091220
* it is advisable to just compare `guild.id === guild2.id` as it is much faster and is often

packages/discord.js/typings/index.d.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1281,6 +1281,7 @@ export class Guild extends AnonymousGuild {
12811281
public fetchWidget(): Promise<Widget>;
12821282
public fetchWidgetSettings(): Promise<GuildWidgetSettings>;
12831283
public leave(): Promise<Guild>;
1284+
public disableInvites(disabled?: boolean): Promise<Guild>;
12841285
public setAFKChannel(afkChannel: VoiceChannelResolvable | null, reason?: string): Promise<Guild>;
12851286
public setAFKTimeout(afkTimeout: number, reason?: string): Promise<Guild>;
12861287
public setBanner(banner: BufferResolvable | Base64Resolvable | null, reason?: string): Promise<Guild>;

0 commit comments

Comments
 (0)