Skip to content

Commit 3bab4ec

Browse files
devsnekamishshah
authored andcommitted
Add time methods to Audit Log entries (#1443)
* aaaaa * Update GuildAuditLogs.js
1 parent 2bf8a36 commit 3bab4ec

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

src/structures/GuildAuditLogs.js

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
const Collection = require('../util/Collection');
2+
const Snowflake = require('../util/Snowflake');
23

34
const Targets = {
45
GUILD: 'GUILD',
@@ -226,6 +227,24 @@ class GuildAuditLogsEntry {
226227
this.target = guild[`${targetType.toLowerCase()}s`].get(data.target_id);
227228
}
228229
}
230+
231+
/**
232+
* The timestamp this entry was created at
233+
* @type {number}
234+
* @readonly
235+
*/
236+
get createdTimestamp() {
237+
return Snowflake.deconstruct(this.id).timestamp;
238+
}
239+
240+
/**
241+
* The time this entry was created
242+
* @type {Date}
243+
* @readonly
244+
*/
245+
get createdAt() {
246+
return new Date(this.createdTimestamp);
247+
}
229248
}
230249

231250
GuildAuditLogs.Actions = Actions;

0 commit comments

Comments
 (0)