mirror of
https://github.com/chylex/Discord-History-Tracker.git
synced 2025-04-10 17:15:43 +02:00
Update message timestamp processing for latest Discord update (Backport 9030a2f
)
This commit is contained in:
parent
af48bf60ce
commit
472f83dd78
@ -113,6 +113,16 @@ class SAVEFILE{
|
||||
static isValid(parsedObj){
|
||||
return parsedObj && typeof parsedObj.meta === "object" && typeof parsedObj.data === "object";
|
||||
}
|
||||
|
||||
static getDate(date){
|
||||
if (date instanceof Date) {
|
||||
return date;
|
||||
}
|
||||
else {
|
||||
// noinspection JSUnresolvedReference
|
||||
return date.toDate();
|
||||
}
|
||||
};
|
||||
|
||||
findOrRegisterUser(userId, userName, userDiscriminator, userAvatar){
|
||||
var wasPresent = userId in this.meta.users;
|
||||
@ -203,7 +213,7 @@ class SAVEFILE{
|
||||
|
||||
var obj = {
|
||||
u: this.findOrRegisterUser(author.id, author.username, author.bot ? null : author.discriminator, author.avatar),
|
||||
t: discordMessage.timestamp.toDate().getTime()
|
||||
t: SAVEFILE.getDate(discordMessage.timestamp).getTime()
|
||||
};
|
||||
|
||||
if (discordMessage.content.length > 0){
|
||||
@ -211,7 +221,7 @@ class SAVEFILE{
|
||||
}
|
||||
|
||||
if (discordMessage.editedTimestamp !== null){
|
||||
obj.te = discordMessage.editedTimestamp.toDate().getTime();
|
||||
obj.te = SAVEFILE.getDate(discordMessage.editedTimestamp).getTime();
|
||||
}
|
||||
|
||||
if (discordMessage.embeds.length > 0){
|
||||
|
Loading…
Reference in New Issue
Block a user