mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-14 10:33:30 +01:00
fix(Emoji): remove incorrect nullables, add ApplicationEmoji#available (#10990)
fix: remove incorrect nullables, add `ApplicationEmoji#available` Co-authored-by: Amgelo563 <61554601+Amgelo563@users.noreply.github.com>
This commit is contained in:
@@ -16,37 +16,42 @@ class ApplicationEmoji extends Emoji {
|
|||||||
*/
|
*/
|
||||||
this.application = application;
|
this.application = application;
|
||||||
|
|
||||||
/**
|
|
||||||
* The user who created this emoji
|
|
||||||
* @type {?User}
|
|
||||||
*/
|
|
||||||
this.author = null;
|
|
||||||
|
|
||||||
this.managed = null;
|
|
||||||
this.requiresColons = null;
|
|
||||||
|
|
||||||
this._patch(data);
|
this._patch(data);
|
||||||
}
|
}
|
||||||
|
|
||||||
_patch(data) {
|
_patch(data) {
|
||||||
if ('name' in data) this.name = data.name;
|
if ('name' in data) this.name = data.name;
|
||||||
if (data.user) this.author = this.client.users._add(data.user);
|
if (data.user) {
|
||||||
|
/**
|
||||||
|
* The user who created this emoji
|
||||||
|
* @type {User}
|
||||||
|
*/
|
||||||
|
this.author = this.client.users._add(data.user);
|
||||||
|
}
|
||||||
|
|
||||||
if ('managed' in data) {
|
if ('managed' in data) {
|
||||||
/**
|
/**
|
||||||
* Whether this emoji is managed by an external service
|
* Whether this emoji is managed by an external service. Always `false` for application emojis
|
||||||
* @type {?boolean}
|
* @type {false}
|
||||||
*/
|
*/
|
||||||
this.managed = data.managed;
|
this.managed = data.managed;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ('require_colons' in data) {
|
if ('require_colons' in data) {
|
||||||
/**
|
/**
|
||||||
* Whether or not this emoji requires colons surrounding it
|
* Whether this emoji requires colons surrounding it. Always `true` for application emojis
|
||||||
* @type {?boolean}
|
* @type {true}
|
||||||
*/
|
*/
|
||||||
this.requiresColons = data.require_colons;
|
this.requiresColons = data.require_colons;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ('available' in data) {
|
||||||
|
/**
|
||||||
|
* Whether this emoji is available. Always `true` for application emojis
|
||||||
|
* @type {true}
|
||||||
|
*/
|
||||||
|
this.available = data.available;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -107,7 +112,8 @@ class ApplicationEmoji extends Emoji {
|
|||||||
other.id === this.id &&
|
other.id === this.id &&
|
||||||
other.name === this.name &&
|
other.name === this.name &&
|
||||||
other.managed === this.managed &&
|
other.managed === this.managed &&
|
||||||
other.requiresColons === this.requiresColons
|
other.requiresColons === this.requiresColons &&
|
||||||
|
other.available === this.available
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -115,4 +121,49 @@ class ApplicationEmoji extends Emoji {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The emoji's name
|
||||||
|
* @name name
|
||||||
|
* @memberof ApplicationEmoji
|
||||||
|
* @instance
|
||||||
|
* @type {string}
|
||||||
|
* @readonly
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Whether the emoji is animated
|
||||||
|
* @name animated
|
||||||
|
* @memberof ApplicationEmoji
|
||||||
|
* @instance
|
||||||
|
* @type {boolean}
|
||||||
|
* @readonly
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns a URL for the emoji.
|
||||||
|
* @method imageURL
|
||||||
|
* @memberof ApplicationEmoji
|
||||||
|
* @instance
|
||||||
|
* @param {EmojiURLOptions} [options] Options for the image URL
|
||||||
|
* @returns {string}
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 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;
|
module.exports = ApplicationEmoji;
|
||||||
|
|||||||
@@ -72,4 +72,40 @@ class BaseGuildEmoji extends Emoji {
|
|||||||
* @deprecated Use {@link BaseGuildEmoji#imageURL} instead.
|
* @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;
|
module.exports = BaseGuildEmoji;
|
||||||
|
|||||||
18
packages/discord.js/typings/index.d.ts
vendored
18
packages/discord.js/typings/index.d.ts
vendored
@@ -37,7 +37,7 @@ import {
|
|||||||
} from '@discordjs/formatters';
|
} from '@discordjs/formatters';
|
||||||
import { Awaitable, JSONEncodable } from '@discordjs/util';
|
import { Awaitable, JSONEncodable } from '@discordjs/util';
|
||||||
import { Collection, ReadonlyCollection } from '@discordjs/collection';
|
import { Collection, ReadonlyCollection } from '@discordjs/collection';
|
||||||
import { BaseImageURLOptions, ImageURLOptions, RawFile, REST, RESTOptions, EmojiURLOptions } from '@discordjs/rest';
|
import { BaseImageURLOptions, EmojiURLOptions, ImageURLOptions, RawFile, REST, RESTOptions } from '@discordjs/rest';
|
||||||
import {
|
import {
|
||||||
WebSocketManager as WSWebSocketManager,
|
WebSocketManager as WSWebSocketManager,
|
||||||
IShardingStrategy,
|
IShardingStrategy,
|
||||||
@@ -705,7 +705,9 @@ export class BaseGuildEmoji extends Emoji {
|
|||||||
public get createdTimestamp(): number;
|
public get createdTimestamp(): number;
|
||||||
public guild: Guild | GuildPreview;
|
public guild: Guild | GuildPreview;
|
||||||
public id: Snowflake;
|
public id: Snowflake;
|
||||||
public managed: boolean | null;
|
public name: string;
|
||||||
|
public animated: boolean;
|
||||||
|
public managed: boolean;
|
||||||
public requiresColons: boolean | null;
|
public requiresColons: boolean | null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1512,10 +1514,16 @@ export class ApplicationEmoji extends Emoji {
|
|||||||
private constructor(client: Client<true>, data: RawApplicationEmojiData, application: ClientApplication);
|
private constructor(client: Client<true>, data: RawApplicationEmojiData, application: ClientApplication);
|
||||||
|
|
||||||
public application: ClientApplication;
|
public application: ClientApplication;
|
||||||
public author: User | null;
|
public author: User;
|
||||||
public id: Snowflake;
|
public id: Snowflake;
|
||||||
public managed: boolean | null;
|
public managed: false;
|
||||||
public requiresColons: boolean | null;
|
public requiresColons: true;
|
||||||
|
public name: string;
|
||||||
|
public animated: boolean;
|
||||||
|
public available: true;
|
||||||
|
public get createdAt(): Date;
|
||||||
|
public get createdTimestamp(): number;
|
||||||
|
public imageURL(options?: EmojiURLOptions): string;
|
||||||
public delete(): Promise<ApplicationEmoji>;
|
public delete(): Promise<ApplicationEmoji>;
|
||||||
public edit(options: ApplicationEmojiEditOptions): Promise<ApplicationEmoji>;
|
public edit(options: ApplicationEmojiEditOptions): Promise<ApplicationEmoji>;
|
||||||
public equals(other: ApplicationEmoji | unknown): boolean;
|
public equals(other: ApplicationEmoji | unknown): boolean;
|
||||||
|
|||||||
Reference in New Issue
Block a user