mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-17 12:03:31 +01:00
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 <62872992+thehackerboi69github@users.noreply.github.com> Co-authored-by: Hackerboi 69 <62872992+thehackerboi69github@users.noreply.github.com> Co-authored-by: Aura Román <kyradiscord@gmail.com>
This commit is contained in:
@@ -1204,6 +1204,17 @@ class Guild extends AnonymousGuild {
|
|||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets whether this guild's invites are disabled.
|
||||||
|
* @param {boolean} [disabled=true] Whether the invites are disabled
|
||||||
|
* @returns {Promise<Guild>}
|
||||||
|
*/
|
||||||
|
async disableInvites(disabled = true) {
|
||||||
|
const features = this.features.filter(feature => feature !== GuildFeature.InvitesDisabled);
|
||||||
|
if (disabled) features.push(GuildFeature.InvitesDisabled);
|
||||||
|
return this.edit({ features });
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Whether this guild equals another guild. It compares all properties, so for most operations
|
* Whether this guild equals another guild. It compares all properties, so for most operations
|
||||||
* it is advisable to just compare `guild.id === guild2.id` as it is much faster and is often
|
* it is advisable to just compare `guild.id === guild2.id` as it is much faster and is often
|
||||||
|
|||||||
1
packages/discord.js/typings/index.d.ts
vendored
1
packages/discord.js/typings/index.d.ts
vendored
@@ -1281,6 +1281,7 @@ export class Guild extends AnonymousGuild {
|
|||||||
public fetchWidget(): Promise<Widget>;
|
public fetchWidget(): Promise<Widget>;
|
||||||
public fetchWidgetSettings(): Promise<GuildWidgetSettings>;
|
public fetchWidgetSettings(): Promise<GuildWidgetSettings>;
|
||||||
public leave(): Promise<Guild>;
|
public leave(): Promise<Guild>;
|
||||||
|
public disableInvites(disabled?: boolean): Promise<Guild>;
|
||||||
public setAFKChannel(afkChannel: VoiceChannelResolvable | null, reason?: string): Promise<Guild>;
|
public setAFKChannel(afkChannel: VoiceChannelResolvable | null, reason?: string): Promise<Guild>;
|
||||||
public setAFKTimeout(afkTimeout: number, reason?: string): Promise<Guild>;
|
public setAFKTimeout(afkTimeout: number, reason?: string): Promise<Guild>;
|
||||||
public setBanner(banner: BufferResolvable | Base64Resolvable | null, reason?: string): Promise<Guild>;
|
public setBanner(banner: BufferResolvable | Base64Resolvable | null, reason?: string): Promise<Guild>;
|
||||||
|
|||||||
Reference in New Issue
Block a user