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

feat(Guild): add premiumProgressbarEnabled #6887

Merged
merged 4 commits into from
Dec 1, 2021
Merged
Show file tree
Hide file tree
Changes from 3 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
20 changes: 20 additions & 0 deletions src/structures/Guild.js
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,14 @@ class Guild extends AnonymousGuild {
this.large = Boolean(data.large);
}

if ('premium_progress_bar_enabled' in data) {
iCrawl marked this conversation as resolved.
Show resolved Hide resolved
/**
* Whether this guild has its premium (boost) progress bar enabled
* @type {boolean}
*/
this.premiumProgressBarEnabled = data.premium_progress_bar_enabled;
}

/**
* An array of enabled guild features, here are the possible values:
* * ANIMATED_ICON
Expand Down Expand Up @@ -784,6 +792,7 @@ class Guild extends AnonymousGuild {
* @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 {Features[]} [features] The features of the guild
*/
Expand Down Expand Up @@ -866,6 +875,7 @@ class Guild extends AnonymousGuild {
_data.description = data.description;
}
if (data.preferredLocale) _data.preferred_locale = data.preferredLocale;
if (data.premiumProgressBarEnabled) _data.premium_progress_bar_enabled = data.premiumProgressBarEnabled;
ImRodry marked this conversation as resolved.
Show resolved Hide resolved
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 @@ -1166,6 +1176,16 @@ class Guild extends AnonymousGuild {
return this.edit({ preferredLocale }, reason);
}

/**
* Edits the enabled state of the guild's premium progress bar
* @param {boolean} [enabled=true] The new enabled state of the guild's premium progress bar
* @param {string} [reason] Reason for changing the state of the guild's premium progress bar
* @returns {Promise<Guild>}
*/
setPremiumProgressBarEnabled(enabled = true, reason) {
return this.edit({ premiumProgressBarEnabled: enabled }, reason);
}

/**
* Data that can be resolved to give a Category Channel object. This can be:
* * A CategoryChannel object
Expand Down
3 changes: 3 additions & 0 deletions typings/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -756,6 +756,7 @@ export class Guild extends AnonymousGuild {
public ownerId: Snowflake;
public preferredLocale: string;
public premiumSubscriptionCount: number | null;
public premiumProgressBarEnabled: boolean;
ImRodry marked this conversation as resolved.
Show resolved Hide resolved
public premiumTier: PremiumTier;
public presences: PresenceManager;
public readonly publicUpdatesChannel: TextChannel | null;
Expand Down Expand Up @@ -821,6 +822,7 @@ export class Guild extends AnonymousGuild {
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 setPremiumProgressBarEnabled(enabled?: boolean, reason?: string): Promise<Guild>;
public setWidgetSettings(settings: GuildWidgetSettingsData, reason?: string): Promise<Guild>;
public toJSON(): unknown;
}
Expand Down Expand Up @@ -4133,6 +4135,7 @@ export interface GuildEditData {
rulesChannel?: TextChannelResolvable;
publicUpdatesChannel?: TextChannelResolvable;
preferredLocale?: string;
premiumProgressBarEnabled?: boolean;
description?: string | null;
features?: GuildFeatures[];
}
Expand Down