mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-11 09:03:29 +01:00
feat(Emoji): move createdAt and createdTimestamp getters from GuildEmoji (#2872)
This commit is contained in:
@@ -1,5 +1,7 @@
|
||||
const Snowflake = require('../util/Snowflake');
|
||||
const Base = require('./Base');
|
||||
|
||||
|
||||
/**
|
||||
* Represents an emoji, see {@link GuildEmoji} and {@link ReactionEmoji}.
|
||||
* @extends {Base}
|
||||
@@ -52,6 +54,26 @@ class Emoji extends Base {
|
||||
return this.client.rest.cdn.Emoji(this.id, this.animated ? 'gif' : 'png');
|
||||
}
|
||||
|
||||
/**
|
||||
* The timestamp the emoji was created at, or null if unicode
|
||||
* @type {?number}
|
||||
* @readonly
|
||||
*/
|
||||
get createdTimestamp() {
|
||||
if (!this.id) return null;
|
||||
return Snowflake.deconstruct(this.id).timestamp;
|
||||
}
|
||||
|
||||
/**
|
||||
* The time the emoji was created at, or null if unicode
|
||||
* @type {?Date}
|
||||
* @readonly
|
||||
*/
|
||||
get createdAt() {
|
||||
if (!this.id) return null;
|
||||
return new Date(this.createdTimestamp);
|
||||
}
|
||||
|
||||
/**
|
||||
* When concatenated with a string, this automatically returns the text required to form a graphical emoji on Discord
|
||||
* instead of the Emoji object.
|
||||
|
||||
Reference in New Issue
Block a user