Skip to content

Commit

Permalink
fix(Guild): don't patch before instance properties (#5885)
Browse files Browse the repository at this point in the history
Co-authored-by: BannerBomb <BannerBomb55@gmail.com>
  • Loading branch information
ckohen and BannerBomb committed Jun 20, 2021
1 parent 1f8f3ab commit 174b7a7
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 3 deletions.
4 changes: 2 additions & 2 deletions src/structures/AnonymousGuild.js
Expand Up @@ -8,9 +8,9 @@ const { VerificationLevels, NSFWLevels } = require('../util/Constants');
* @abstract
*/
class AnonymousGuild extends BaseGuild {
constructor(client, data) {
constructor(client, data, immediatePatch = true) {
super(client, data);
this._patch(data);
if (immediatePatch) this._patch(data);
}

_patch(data) {
Expand Down
2 changes: 1 addition & 1 deletion src/structures/Guild.js
Expand Up @@ -41,7 +41,7 @@ const Util = require('../util/Util');
*/
class Guild extends AnonymousGuild {
constructor(client, data) {
super(client, data);
super(client, data, false);

/**
* A manager of the application commands belonging to this guild
Expand Down
2 changes: 2 additions & 0 deletions typings/index.d.ts
Expand Up @@ -188,6 +188,7 @@ declare module 'discord.js' {
}

export abstract class AnonymousGuild extends BaseGuild {
constructor(client: Client, data: unknown, immediatePatch?: boolean);
public banner: string | null;
public description: string | null;
public nsfwLevel: NSFWLevel;
Expand Down Expand Up @@ -294,6 +295,7 @@ declare module 'discord.js' {
}

export abstract class BaseGuild extends Base {
constructor(client: Client, data: unknown);
public readonly createdAt: Date;
public readonly createdTimestamp: number;
public features: GuildFeatures[];
Expand Down

0 comments on commit 174b7a7

Please sign in to comment.