Skip to content

Commit

Permalink
Add time methods to Audit Log entries (#1443)
Browse files Browse the repository at this point in the history
* aaaaa

* Update GuildAuditLogs.js
  • Loading branch information
devsnek authored and amishshah committed May 1, 2017
1 parent 2bf8a36 commit 3bab4ec
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions src/structures/GuildAuditLogs.js
@@ -1,4 +1,5 @@
const Collection = require('../util/Collection');
const Snowflake = require('../util/Snowflake');

const Targets = {
GUILD: 'GUILD',
Expand Down Expand Up @@ -226,6 +227,24 @@ class GuildAuditLogsEntry {
this.target = guild[`${targetType.toLowerCase()}s`].get(data.target_id);
}
}

/**
* The timestamp this entry was created at
* @type {number}
* @readonly
*/
get createdTimestamp() {
return Snowflake.deconstruct(this.id).timestamp;
}

/**
* The time this entry was created
* @type {Date}
* @readonly
*/
get createdAt() {
return new Date(this.createdTimestamp);
}
}

GuildAuditLogs.Actions = Actions;
Expand Down

0 comments on commit 3bab4ec

Please sign in to comment.