Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(GuildEditData): some fields can be null for v13 #7633

Merged
merged 2 commits into from Apr 19, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
38 changes: 19 additions & 19 deletions src/structures/Guild.js
Expand Up @@ -808,24 +808,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 {Features[]} [features] The features of the guild
*/

Expand Down Expand Up @@ -906,7 +906,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;
almeidx marked this conversation as resolved.
Show resolved Hide resolved
if ('premiumProgressBarEnabled' in data) _data.premium_progress_bar_enabled = data.premiumProgressBarEnabled;
const newData = await this.client.api.guilds(this.id).patch({ data: _data, reason });
return this.client.actions.GuildUpdate.handle(newData).updated;
Expand Down Expand Up @@ -984,7 +984,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<Guild>}
*/
Expand All @@ -995,7 +995,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<Guild>}
*/
Expand Down Expand Up @@ -1031,7 +1031,7 @@ class Guild extends AnonymousGuild {

/**
* Edits the verification level of the guild.
* @param {VerificationLevel|number} verificationLevel The new verification level of the guild
* @param {?(VerificationLevel|number)} verificationLevel The new verification level of the guild
* @param {string} [reason] Reason for changing the guild's verification level
* @returns {Promise<Guild>}
* @example
Expand All @@ -1046,7 +1046,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<Guild>}
* @example
Expand All @@ -1061,7 +1061,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<Guild>}
* @example
Expand Down Expand Up @@ -1166,7 +1166,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<Guild>}
* @example
Expand All @@ -1181,7 +1181,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<Guild>}
* @example
Expand All @@ -1196,7 +1196,7 @@ class Guild extends AnonymousGuild {

/**
* Edits the preferred locale of the guild.
* @param {string} preferredLocale The new preferred locale of the guild
* @param {?string} preferredLocale The new preferred locale of the guild
* @param {string} [reason] Reason for changing the guild's preferred locale
* @returns {Promise<Guild>}
* @example
Expand Down
24 changes: 12 additions & 12 deletions typings/index.d.ts
Expand Up @@ -954,29 +954,29 @@ export class Guild extends AnonymousGuild {
/** @deprecated Use {@link GuildChannelManager.setPositions} instead */
public setChannelPositions(channelPositions: readonly ChannelPosition[]): Promise<Guild>;
public setDefaultMessageNotifications(
defaultMessageNotifications: DefaultMessageNotificationLevel | number,
defaultMessageNotifications: DefaultMessageNotificationLevel | number | null,
reason?: string,
): Promise<Guild>;
public setDiscoverySplash(
discoverySplash: BufferResolvable | Base64Resolvable | null,
reason?: string,
): Promise<Guild>;
public setExplicitContentFilter(
explicitContentFilter: ExplicitContentFilterLevel | number,
explicitContentFilter: ExplicitContentFilterLevel | number | null,
reason?: string,
): Promise<Guild>;
public setIcon(icon: BufferResolvable | Base64Resolvable | null, reason?: string): Promise<Guild>;
public setName(name: string, reason?: string): Promise<Guild>;
public setOwner(owner: GuildMemberResolvable, reason?: string): Promise<Guild>;
public setPreferredLocale(preferredLocale: string, reason?: string): Promise<Guild>;
public setPreferredLocale(preferredLocale: string | null, reason?: string): Promise<Guild>;
public setPublicUpdatesChannel(publicUpdatesChannel: TextChannelResolvable | null, reason?: string): Promise<Guild>;
/** @deprecated Use {@link RoleManager.setPositions} instead */
public setRolePositions(rolePositions: readonly RolePosition[]): Promise<Guild>;
public setRulesChannel(rulesChannel: TextChannelResolvable | null, reason?: string): Promise<Guild>;
public setSplash(splash: BufferResolvable | Base64Resolvable | null, reason?: string): Promise<Guild>;
public setSystemChannel(systemChannel: TextChannelResolvable | null, reason?: string): Promise<Guild>;
public setSystemChannelFlags(systemChannelFlags: SystemChannelFlagsResolvable, reason?: string): Promise<Guild>;
public setVerificationLevel(verificationLevel: VerificationLevel | number, reason?: string): Promise<Guild>;
public setVerificationLevel(verificationLevel: VerificationLevel | number | null, reason?: string): Promise<Guild>;
public setPremiumProgressBarEnabled(enabled?: boolean, reason?: string): Promise<Guild>;
public setWidgetSettings(settings: GuildWidgetSettingsData, reason?: string): Promise<Guild>;
public toJSON(): unknown;
Expand Down Expand Up @@ -4689,21 +4689,21 @@ export interface GuildWidgetSettings {

export interface GuildEditData {
name?: string;
verificationLevel?: VerificationLevel | number;
explicitContentFilter?: ExplicitContentFilterLevel | number;
defaultMessageNotifications?: DefaultMessageNotificationLevel | number;
afkChannel?: VoiceChannelResolvable;
systemChannel?: TextChannelResolvable;
verificationLevel?: VerificationLevel | number | null;
explicitContentFilter?: ExplicitContentFilterLevel | number | null;
defaultMessageNotifications?: DefaultMessageNotificationLevel | number | null;
afkChannel?: VoiceChannelResolvable | null;
systemChannel?: TextChannelResolvable | null;
systemChannelFlags?: SystemChannelFlagsResolvable;
afkTimeout?: number;
icon?: BufferResolvable | Base64Resolvable | null;
owner?: GuildMemberResolvable;
splash?: BufferResolvable | Base64Resolvable | null;
discoverySplash?: BufferResolvable | Base64Resolvable | null;
banner?: BufferResolvable | Base64Resolvable | null;
rulesChannel?: TextChannelResolvable;
publicUpdatesChannel?: TextChannelResolvable;
preferredLocale?: string;
rulesChannel?: TextChannelResolvable | null;
publicUpdatesChannel?: TextChannelResolvable | null;
preferredLocale?: string | null;
premiumProgressBarEnabled?: boolean;
description?: string | null;
features?: GuildFeatures[];
Expand Down