mirror of
https://github.com/danbulant/discord.js
synced 2026-06-08 01:01:30 +00:00
Add time methods to Audit Log entries (#1443)
* aaaaa * Update GuildAuditLogs.js
This commit is contained in:
parent
2bf8a36077
commit
3bab4ec9fd
1 changed files with 19 additions and 0 deletions
|
|
@ -1,4 +1,5 @@
|
||||||
const Collection = require('../util/Collection');
|
const Collection = require('../util/Collection');
|
||||||
|
const Snowflake = require('../util/Snowflake');
|
||||||
|
|
||||||
const Targets = {
|
const Targets = {
|
||||||
GUILD: 'GUILD',
|
GUILD: 'GUILD',
|
||||||
|
|
@ -226,6 +227,24 @@ class GuildAuditLogsEntry {
|
||||||
this.target = guild[`${targetType.toLowerCase()}s`].get(data.target_id);
|
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;
|
GuildAuditLogs.Actions = Actions;
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue