diff --git a/packages/discord.js/src/structures/Guild.js b/packages/discord.js/src/structures/Guild.js index 42d7d0391..97b4f55bf 100644 --- a/packages/discord.js/src/structures/Guild.js +++ b/packages/discord.js/src/structures/Guild.js @@ -739,24 +739,24 @@ class Guild extends AnonymousGuild { * The data for editing a guild. * @typedef {Object} GuildEditData * @property {string} [name] The name of the guild - * @property {VerificationLevel|number} [verificationLevel] The verification level of the guild - * @property {ExplicitContentFilterLevel|number} [explicitContentFilter] The level of the explicit content filter - * @property {VoiceChannelResolvable} [afkChannel] The AFK channel of the guild - * @property {TextChannelResolvable} [systemChannel] The system channel of the guild + * @property {?(VerificationLevel|number)} [verificationLevel] The verification level of the guild + * @property {?(ExplicitContentFilterLevel|number)} [explicitContentFilter] The level of the explicit content filter + * @property {?VoiceChannelResolvable} [afkChannel] The AFK channel of the guild + * @property {?TextChannelResolvable} [systemChannel] The system channel of the guild * @property {number} [afkTimeout] The AFK timeout of the guild * @property {?(BufferResolvable|Base64Resolvable)} [icon] The icon of the guild * @property {GuildMemberResolvable} [owner] The owner of the guild * @property {?(BufferResolvable|Base64Resolvable)} [splash] The invite splash image of the guild * @property {?(BufferResolvable|Base64Resolvable)} [discoverySplash] The discovery splash image of the guild * @property {?(BufferResolvable|Base64Resolvable)} [banner] The banner of the guild - * @property {DefaultMessageNotificationLevel|number} [defaultMessageNotifications] The default message notification - * level of the guild + * @property {?(DefaultMessageNotificationLevel|number)} [defaultMessageNotifications] The default message + * notification level of the guild * @property {SystemChannelFlagsResolvable} [systemChannelFlags] The system channel flags of the guild - * @property {TextChannelResolvable} [rulesChannel] The rules channel of the guild - * @property {TextChannelResolvable} [publicUpdatesChannel] The community updates channel of the guild - * @property {string} [preferredLocale] The preferred locale of the guild + * @property {?TextChannelResolvable} [rulesChannel] The rules channel of the guild + * @property {?TextChannelResolvable} [publicUpdatesChannel] The community updates channel of the guild + * @property {?string} [preferredLocale] The preferred locale of the guild * @property {boolean} [premiumProgressBarEnabled] Whether the guild's premium progress bar is enabled - * @property {string} [description] The discovery description of the guild + * @property {?string} [description] The discovery description of the guild * @property {GuildFeature[]} [features] The features of the guild */ @@ -828,7 +828,7 @@ class Guild extends AnonymousGuild { if (typeof data.description !== 'undefined') { _data.description = data.description; } - if (data.preferredLocale) _data.preferred_locale = data.preferredLocale; + if (typeof data.preferredLocale !== 'undefined') _data.preferred_locale = data.preferredLocale; if ('premiumProgressBarEnabled' in data) _data.premium_progress_bar_enabled = data.premiumProgressBarEnabled; const newData = await this.client.rest.patch(Routes.guild(this.id), { body: _data, reason }); return this.client.actions.GuildUpdate.handle(newData).updated; @@ -906,7 +906,7 @@ class Guild extends AnonymousGuild { /** * Edits the level of the explicit content filter. - * @param {ExplicitContentFilterLevel|number} explicitContentFilter The new level of the explicit content filter + * @param {?(ExplicitContentFilterLevel|number)} explicitContentFilter The new level of the explicit content filter * @param {string} [reason] Reason for changing the level of the guild's explicit content filter * @returns {Promise} */ @@ -917,7 +917,7 @@ class Guild extends AnonymousGuild { /* eslint-disable max-len */ /** * Edits the setting of the default message notifications of the guild. - * @param {DefaultMessageNotificationLevel|number} defaultMessageNotifications The new default message notification level of the guild + * @param {?(DefaultMessageNotificationLevel|number)} defaultMessageNotifications The new default message notification level of the guild * @param {string} [reason] Reason for changing the setting of the default message notifications * @returns {Promise} */ @@ -953,7 +953,7 @@ class Guild extends AnonymousGuild { /** * Edits the verification level of the guild. - * @param {VerificationLevel} verificationLevel The new verification level of the guild + * @param {?VerificationLevel} verificationLevel The new verification level of the guild * @param {string} [reason] Reason for changing the guild's verification level * @returns {Promise} * @example @@ -968,7 +968,7 @@ class Guild extends AnonymousGuild { /** * Edits the AFK channel of the guild. - * @param {VoiceChannelResolvable} afkChannel The new AFK channel + * @param {?VoiceChannelResolvable} afkChannel The new AFK channel * @param {string} [reason] Reason for changing the guild's AFK channel * @returns {Promise} * @example @@ -983,7 +983,7 @@ class Guild extends AnonymousGuild { /** * Edits the system channel of the guild. - * @param {TextChannelResolvable} systemChannel The new system channel + * @param {?TextChannelResolvable} systemChannel The new system channel * @param {string} [reason] Reason for changing the guild's system channel * @returns {Promise} * @example @@ -1088,7 +1088,7 @@ class Guild extends AnonymousGuild { /** * Edits the rules channel of the guild. - * @param {TextChannelResolvable} rulesChannel The new rules channel + * @param {?TextChannelResolvable} rulesChannel The new rules channel * @param {string} [reason] Reason for changing the guild's rules channel * @returns {Promise} * @example @@ -1103,7 +1103,7 @@ class Guild extends AnonymousGuild { /** * Edits the community updates channel of the guild. - * @param {TextChannelResolvable} publicUpdatesChannel The new community updates channel + * @param {?TextChannelResolvable} publicUpdatesChannel The new community updates channel * @param {string} [reason] Reason for changing the guild's community updates channel * @returns {Promise} * @example @@ -1118,7 +1118,7 @@ class Guild extends AnonymousGuild { /** * Edits the preferred locale of the guild. - * @param {string} preferredLocale The new preferred locale of the guild + * @param {?Locale} preferredLocale The new preferred locale of the guild * @param {string} [reason] Reason for changing the guild's preferred locale * @returns {Promise} * @example diff --git a/packages/discord.js/typings/index.d.ts b/packages/discord.js/typings/index.d.ts index 61e07c7c3..bedc52e0d 100644 --- a/packages/discord.js/typings/index.d.ts +++ b/packages/discord.js/typings/index.d.ts @@ -1099,24 +1099,27 @@ export class Guild extends AnonymousGuild { public setAFKTimeout(afkTimeout: number, reason?: string): Promise; public setBanner(banner: BufferResolvable | Base64Resolvable | null, reason?: string): Promise; public setDefaultMessageNotifications( - defaultMessageNotifications: GuildDefaultMessageNotifications, + defaultMessageNotifications: GuildDefaultMessageNotifications | null, reason?: string, ): Promise; public setDiscoverySplash( discoverySplash: BufferResolvable | Base64Resolvable | null, reason?: string, ): Promise; - public setExplicitContentFilter(explicitContentFilter: GuildExplicitContentFilter, reason?: string): Promise; + public setExplicitContentFilter( + explicitContentFilter: GuildExplicitContentFilter | null, + reason?: string, + ): Promise; public setIcon(icon: BufferResolvable | Base64Resolvable | null, reason?: string): Promise; public setName(name: string, reason?: string): Promise; public setOwner(owner: GuildMemberResolvable, reason?: string): Promise; - public setPreferredLocale(preferredLocale: Locale, reason?: string): Promise; + public setPreferredLocale(preferredLocale: Locale | null, reason?: string): Promise; public setPublicUpdatesChannel(publicUpdatesChannel: TextChannelResolvable | null, reason?: string): Promise; public setRulesChannel(rulesChannel: TextChannelResolvable | null, reason?: string): Promise; public setSplash(splash: BufferResolvable | Base64Resolvable | null, reason?: string): Promise; public setSystemChannel(systemChannel: TextChannelResolvable | null, reason?: string): Promise; public setSystemChannelFlags(systemChannelFlags: SystemChannelFlagsResolvable, reason?: string): Promise; - public setVerificationLevel(verificationLevel: GuildVerificationLevel, reason?: string): Promise; + public setVerificationLevel(verificationLevel: GuildVerificationLevel | null, reason?: string): Promise; public setPremiumProgressBarEnabled(enabled?: boolean, reason?: string): Promise; public setWidgetSettings(settings: GuildWidgetSettingsData, reason?: string): Promise; public toJSON(): unknown; @@ -4442,11 +4445,11 @@ export interface GuildWidgetSettings { export interface GuildEditData { name?: string; - verificationLevel?: GuildVerificationLevel; - explicitContentFilter?: GuildExplicitContentFilter; - defaultMessageNotifications?: GuildDefaultMessageNotifications; - afkChannel?: VoiceChannelResolvable; - systemChannel?: TextChannelResolvable; + verificationLevel?: GuildVerificationLevel | null; + explicitContentFilter?: GuildExplicitContentFilter | null; + defaultMessageNotifications?: GuildDefaultMessageNotifications | null; + afkChannel?: VoiceChannelResolvable | null; + systemChannel?: TextChannelResolvable | null; systemChannelFlags?: SystemChannelFlagsResolvable; afkTimeout?: number; icon?: BufferResolvable | Base64Resolvable | null; @@ -4454,9 +4457,9 @@ export interface GuildEditData { splash?: BufferResolvable | Base64Resolvable | null; discoverySplash?: BufferResolvable | Base64Resolvable | null; banner?: BufferResolvable | Base64Resolvable | null; - rulesChannel?: TextChannelResolvable; - publicUpdatesChannel?: TextChannelResolvable; - preferredLocale?: Locale; + rulesChannel?: TextChannelResolvable | null; + publicUpdatesChannel?: TextChannelResolvable | null; + preferredLocale?: Locale | null; premiumProgressBarEnabled?: boolean; description?: string | null; features?: GuildFeature[];