mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-09 16:13:31 +01:00
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>
This commit is contained in:
@@ -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<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>}
|
||||
|
||||
2
typings/index.d.ts
vendored
2
typings/index.d.ts
vendored
@@ -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>;
|
||||
@@ -5365,6 +5366,7 @@ export type GuildFeatures =
|
||||
| 'COMMUNITY'
|
||||
| 'DISCOVERABLE'
|
||||
| 'FEATURABLE'
|
||||
| 'INVITES_DISABLED'
|
||||
| 'INVITE_SPLASH'
|
||||
| 'MEMBER_VERIFICATION_GATE_ENABLED'
|
||||
| 'NEWS'
|
||||
|
||||
Reference in New Issue
Block a user