mirror of
https://github.com/danbulant/discord.js
synced 2026-05-25 21:12:06 +00:00
Add <User/Guild/Role/Channel>.createdAt (#620)
* Add Role.createdAt * Add Channel.createdAt * Add Guild.createdAt * Add User.createdAt * Change createdAt to Unix Timestamp * Add createdAt to Emojis * Change createdAt to Unix Timestamp
This commit is contained in:
parent
6dfe160c52
commit
943767dc83
5 changed files with 45 additions and 0 deletions
|
|
@ -31,6 +31,15 @@ class Channel {
|
||||||
this.id = data.id;
|
this.id = data.id;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The unix timestamp the channel was created
|
||||||
|
* @readonly
|
||||||
|
* @type {Date}
|
||||||
|
*/
|
||||||
|
get createdAt() {
|
||||||
|
return new Date((+this.id / 4194304) + 1420070400000).getTime();
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Deletes the channel
|
* Deletes the channel
|
||||||
* @returns {Promise<Channel>}
|
* @returns {Promise<Channel>}
|
||||||
|
|
|
||||||
|
|
@ -43,6 +43,15 @@ class Emoji {
|
||||||
this.managed = data.managed;
|
this.managed = data.managed;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The unix timestamp the emoji was created
|
||||||
|
* @readonly
|
||||||
|
* @type {Date}
|
||||||
|
*/
|
||||||
|
get createdAt() {
|
||||||
|
return new Date((+this.id / 4194304) + 1420070400000).getTime();
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A collection of roles this emoji is active for (empty if all), mapped by role ID.
|
* A collection of roles this emoji is active for (empty if all), mapped by role ID.
|
||||||
* @type {Collection<string, Role>}
|
* @type {Collection<string, Role>}
|
||||||
|
|
|
||||||
|
|
@ -332,6 +332,15 @@ class Guild {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The unix timestamp the guild was created
|
||||||
|
* @readonly
|
||||||
|
* @type {Date}
|
||||||
|
*/
|
||||||
|
get createdAt() {
|
||||||
|
return new Date((+this.id / 4194304) + 1420070400000).getTime();
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The date at which the logged-in client joined the guild.
|
* The date at which the logged-in client joined the guild.
|
||||||
* @type {Date}
|
* @type {Date}
|
||||||
|
|
|
||||||
|
|
@ -67,6 +67,15 @@ class Role {
|
||||||
this.managed = data.managed;
|
this.managed = data.managed;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The unix timestamp the role was created
|
||||||
|
* @readonly
|
||||||
|
* @type {Date}
|
||||||
|
*/
|
||||||
|
get createdAt() {
|
||||||
|
return new Date((+this.id / 4194304) + 1420070400000).getTime();
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Deletes the role
|
* Deletes the role
|
||||||
* @returns {Promise<Role>}
|
* @returns {Promise<Role>}
|
||||||
|
|
|
||||||
|
|
@ -53,6 +53,15 @@ class User {
|
||||||
this.game = data.game || this.game;
|
this.game = data.game || this.game;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The unix timestamp the user was created
|
||||||
|
* @readonly
|
||||||
|
* @type {Date}
|
||||||
|
*/
|
||||||
|
get createdAt() {
|
||||||
|
return new Date((+this.id / 4194304) + 1420070400000).getTime();
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* When concatenated with a string, this automatically concatenates the User's mention instead of the User object.
|
* When concatenated with a string, this automatically concatenates the User's mention instead of the User object.
|
||||||
* @returns {string}
|
* @returns {string}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue