8000 fix: remove incorrect nullables from ApplicationEmoji and GuildEmoji, add ApplicationEmoji#managed by Amgelo563 · Pull Request #10912 · discordjs/discord.js · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

fix: remove incorrect nullables from ApplicationEmoji and GuildEmoji, add ApplicationEmoji#managed #10912

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

Closed
wants to merge 4 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
76 changes: 72 additions & 4 deletions packages/discord.js/src/structures/ApplicationEmoji.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,13 @@ class ApplicationEmoji extends Emoji {

/**
* The user who created this emoji
* @type {?User}
* @type {User}
*/
this.author = null;

this.managed = null;
this.requiresColons = null;
this.available = null;

this._patch(data);
}
Expand All @@ -35,18 +36,29 @@ class ApplicationEmoji extends Emoji {
if ('managed' in data) {
/**
* Whether this emoji is managed by an external service
* @type {?boolean}
* @remarks Always false for application emojis
* @type {false}
*/
this.managed = data.managed;
}

if ('require_colons' in data) {
/**
* Whether or not this emoji requires colons surrounding it
* @type {?boolean}
* @remarks Always true for application emojis
* @type {true}
*/
this.requiresColons = data.require_colons;
}

if ('available' in data) {
/**
* Whether this emoji is available
* @remarks Always true for application emojis
* @type {true}
*/
this.available = data.available;
}
}

/**
Expand Down Expand Up @@ -107,12 +119,68 @@ class ApplicationEmoji extends Emoji {
other.id === this.id &&
other.name === this.name &&
other.managed === this.managed &&
other.requiresColons === this.requiresColons
other.requiresColons === this.requiresColons &&
other.available === this.available
);
}

return other.id === this.id && other.name === this.name;
}
}

/**
* The emoji's name
* @name name
* @memberof ApplicationEmoji
* @instance
* @type {string}
* @readonly
*/

/**
* Whether or not the emoji is animated
* @name animated
* @memberof ApplicationEmoji
* @instance
* @type {boolean}
* @readonly
*/

/**
* Returns a URL for the emoji.
* @method imageURL
* @memberof ApplicationEmoji
* @instance
* @param {BaseImageURLOptions} [options] Options for the image URL
* @returns {string}
*/

/**
* Returns a URL for the emoji.
* @name url
* @memberof ApplicationEmoji
* @instance
* @type {string}
* @readonly
* @deprecated Use {@link ApplicationEmoji#imageURL} instead.
*/

/**
* The time the emoji was created at
* @name createdAt
* @memberof ApplicationEmoji
* @instance
* @type {Date}
* @readonly
*/

/**
* The timestamp the emoji was created at
* @name createdTimestamp
* @memberof ApplicationEmoji
* @instance
* @type {number}
* @readonly
*/

module.exports = ApplicationEmoji;
36 changes: 36 additions & 0 deletions packages/discord.js/src/structures/BaseGuildEmoji.js
Original file line number Diff line number Diff line change
Expand Up @@ -72,4 +72,40 @@ class BaseGuildEmoji extends Emoji {
* @deprecated Use {@link BaseGuildEmoji#imageURL} instead.
*/

/**
* The emoji's name
* @name name
* @memberof BaseGuildEmoji
* @instance
* @type {string}
* @readonly
*/

/**
* Whether or not the emoji is animated
* @name animated
* @memberof BaseGuildEmoji
* @instance
* @type {boolean}
* @readonly
*/

/**
* The time the emoji was created at.
* @name createdAt
* @memberof BaseGuildEmoji
* @instance
* @type {Date}
* @readonly
*/

/**
* The timestamp the emoji was created at.
* @name createdTimestamp
* @memberof BaseGuildEmoji
* @instance
* @type {number}
* @readonly
*/

module.exports = BaseGuildEmoji;
19 changes: 15 additions & 4 deletions packages/discord.js/typings/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -704,13 +704,16 @@ export abstract class BaseGuild extends Base {
export class BaseGuildEmoji extends Emoji {
protected constructor(client: Client<true>, data: RawGuildEmojiData, guild: Guild | GuildPreview);
public imageURL(options?: BaseImageURLOptions): string;
/** @deprecated Use {@link BaseGuildEmoji.imageURL} instead */
public get url(): string;
public available: boolean | null;
public get createdAt(): Date;
public get createdTimestamp(): number;
public guild: Guild | GuildPreview;
public id: Snowflake;
public managed: boolean | null;
public name: string;
public animated: boolean;
public managed: boolean;
public requiresColons: boolean | null;
}

Expand Down Expand Up @@ -1490,10 +1493,18 @@ export class ApplicationEmoji extends Emoji {
private constructor(client: Client<true>, data: RawApplicationEmojiData, application: ClientApplication);

public application: ClientApplication;
public author: User | null;
public author: User;
public id: Snowflake;
public managed: boolean | null;
public requiresColons: boolean | null;
public managed: false;
public requiresColons: true;
public name: string;
public animated: boolean;
public available: true;
public get createdAt(): Date;
public get createdTimestamp(): number;
/** @deprecated Use {@link ApplicationEmoji.imageURL} instead */
public get url(): string;
public imageURL(options?: BaseImageURLOptions): string;
public delete(): Promise<ApplicationEmoji>;
public edit(options: ApplicationEmojiEditOptions): Promise<ApplicationEmoji>;
public equals(other: ApplicationEmoji | unknown): boolean;
Expand Down
Loading
0