Rename createdAt -> creationDate (#628)

* Rename createdAt -> creationDate

Also make it return a Date like it says, and small cleanup

* Build docs
This commit is contained in:
Schuyler Cebulskie
2016-09-06 16:52:10 -04:00
committed by GitHub
parent 6bfad00229
commit 7fea0a3937
7 changed files with 21 additions and 28 deletions

File diff suppressed because one or more lines are too long

View File

@@ -31,12 +31,12 @@ class Channel {
} }
/** /**
* The unix timestamp the channel was created * The time the channel was created
* @readonly * @readonly
* @type {Date} * @type {Date}
*/ */
get createdAt() { get creationDate() {
return new Date((+this.id / 4194304) + 1420070400000).getTime(); return new Date((this.id / 4194304) + 1420070400000);
} }
/** /**

View File

@@ -44,12 +44,12 @@ class Emoji {
} }
/** /**
* The unix timestamp the emoji was created * The time the emoji was created
* @readonly * @readonly
* @type {Date} * @type {Date}
*/ */
get createdAt() { get creationDate() {
return new Date((+this.id / 4194304) + 1420070400000).getTime(); return new Date((this.id / 4194304) + 1420070400000);
} }
/** /**

View File

@@ -252,9 +252,7 @@ class Guild {
* @type {Object[]} * @type {Object[]}
*/ */
this.emojis = new Collection(); this.emojis = new Collection();
for (const emoji of data.emojis) { for (const emoji of data.emojis) this.emojis.set(emoji.id, new Emoji(this, emoji));
this.emojis.set(emoji.id, new Emoji(this, emoji));
}
/** /**
* The time in seconds before a user is counted as "away from keyboard". * The time in seconds before a user is counted as "away from keyboard".
* @type {?number} * @type {?number}
@@ -279,20 +277,14 @@ class Guild {
if (data.members) { if (data.members) {
this.members.clear(); this.members.clear();
for (const guildUser of data.members) { for (const guildUser of data.members) this._addMember(guildUser);
this._addMember(guildUser);
}
} }
if (data.owner_id) { if (data.owner_id) this.ownerID = data.owner_id;
this.ownerID = data.owner_id;
}
if (data.channels) { if (data.channels) {
this.channels.clear(); this.channels.clear();
for (const channel of data.channels) { for (const channel of data.channels) this.client.dataManager.newChannel(channel, this);
this.client.dataManager.newChannel(channel, this);
}
} }
if (data.roles) { if (data.roles) {
@@ -333,12 +325,12 @@ class Guild {
} }
/** /**
* The unix timestamp the guild was created * The time the guild was created
* @readonly * @readonly
* @type {Date} * @type {Date}
*/ */
get createdAt() { get creationDate() {
return new Date((+this.id / 4194304) + 1420070400000).getTime(); return new Date((this.id / 4194304) + 1420070400000);
} }
/** /**

View File

@@ -130,6 +130,7 @@ class Message {
this.system = false; this.system = false;
if (data.type === 6) this.system = true; if (data.type === 6) this.system = true;
} }
/** /**
* When the message was sent * When the message was sent
* @type {Date} * @type {Date}

View File

@@ -68,12 +68,12 @@ class Role {
} }
/** /**
* The unix timestamp the role was created * The time the role was created
* @readonly * @readonly
* @type {Date} * @type {Date}
*/ */
get createdAt() { get creationDate() {
return new Date((+this.id / 4194304) + 1420070400000).getTime(); return new Date((this.id / 4194304) + 1420070400000);
} }
/** /**

View File

@@ -54,12 +54,12 @@ class User {
} }
/** /**
* The unix timestamp the user was created * The time the user was created
* @readonly * @readonly
* @type {Date} * @type {Date}
*/ */
get createdAt() { get creationDate() {
return new Date((+this.id / 4194304) + 1420070400000).getTime(); return new Date((this.id / 4194304) + 1420070400000);
} }
/** /**