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: add animated banner guild feature #6812

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions packages/discord.js/src/structures/Guild.js
Original file line number Diff line number Diff line change
Expand Up @@ -220,6 +220,7 @@ class Guild extends AnonymousGuild {

/**
* An array of enabled guild features, here are the possible values:
* * ANIMATED_BANNER
* * ANIMATED_ICON
* * BANNER
* * COMMERCE
Expand Down Expand Up @@ -512,6 +513,15 @@ class Guild extends AnonymousGuild {
}
}

/**
* The URL to this guild's banner.
* @param {ImageURLOptions} [options={}] Options for the Image URL
* @returns {?string}
*/
bannerURL({ format, size, dynamic } = {}) {
return this.banner && this.client.rest.cdn.Banner(this.id, this.banner, format, size, dynamic);
}

Comment on lines +516 to +524
Copy link
Member

@Jiralite Jiralite Jan 10, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should instead be modified in the AnonymousGuild class:

/**
* The URL to this guild's banner.
* @param {StaticImageURLOptions} [options={}] Options for the Image URL
* @returns {?string}
*/
bannerURL({ format, size } = {}) {
return this.banner && this.client.rest.cdn.Banner(this.id, this.banner, format, size);
}

Both an InviteGuild and a Guild can receive the animated hash.

/**
* The time the client user joined the guild
* @type {Date}
Expand Down
3 changes: 2 additions & 1 deletion packages/discord.js/typings/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,7 @@ export abstract class AnonymousGuild extends BaseGuild {
public splash: string | null;
public vanityURLCode: string | null;
public verificationLevel: VerificationLevel;
public bannerURL(options?: StaticImageURLOptions): string | null;
public bannerURL(options?: ImageURLOptions): string | null;
public splashURL(options?: StaticImageURLOptions): string | null;
}

Expand Down Expand Up @@ -4700,6 +4700,7 @@ export interface GuildStickerEditData {
}

export type GuildFeatures =
| 'ANIMATED_BANNER'
| 'ANIMATED_ICON'
| 'BANNER'
| 'COMMERCE'
Expand Down