1
0
mirror of https://github.com/chylex/Discord-History-Tracker.git synced 2024-11-25 14:42:44 +01:00

Compare commits

..

2 Commits

Author SHA1 Message Date
67b9c12843
Release v41.1 2024-02-15 13:07:36 +01:00
9030a2f010
Update message timestamp processing for latest Discord update
Closes #249
2024-02-15 13:06:06 +01:00
2 changed files with 15 additions and 10 deletions

View File

@ -48,6 +48,16 @@ const STATE = (function() {
}); });
}; };
const getDate = function(date) {
if (date instanceof Date) {
return date;
}
else {
// noinspection JSUnresolvedReference
return date.toDate();
}
};
const trackingStateChangedListeners = []; const trackingStateChangedListeners = [];
let isTracking = false; let isTracking = false;
@ -69,8 +79,8 @@ const STATE = (function() {
* @property {String} channel_id * @property {String} channel_id
* @property {DiscordUser} author * @property {DiscordUser} author
* @property {String} content * @property {String} content
* @property {Timestamp} timestamp * @property {Date} timestamp
* @property {Timestamp|null} editedTimestamp * @property {Date|null} editedTimestamp
* @property {DiscordAttachment[]} attachments * @property {DiscordAttachment[]} attachments
* @property {Object[]} embeds * @property {Object[]} embeds
* @property {DiscordMessageReaction[]} [reactions] * @property {DiscordMessageReaction[]} [reactions]
@ -106,11 +116,6 @@ const STATE = (function() {
* @property {Boolean} animated * @property {Boolean} animated
*/ */
/**
* @name Timestamp
* @property {Function} toDate
*/
return { return {
setup(port, token) { setup(port, token) {
serverPort = port; serverPort = port;
@ -223,12 +228,12 @@ const STATE = (function() {
sender: msg.author.id, sender: msg.author.id,
channel: msg.channel_id, channel: msg.channel_id,
text: msg.content, text: msg.content,
timestamp: msg.timestamp.toDate().getTime() timestamp: getDate(msg.timestamp).getTime()
}; };
if (msg.editedTimestamp !== null) { if (msg.editedTimestamp !== null) {
// noinspection JSUnusedGlobalSymbols // noinspection JSUnusedGlobalSymbols
obj.editTimestamp = msg.editedTimestamp.toDate().getTime(); obj.editTimestamp = getDate(msg.editedTimestamp).getTime();
} }
if (msg.messageReference !== null) { if (msg.messageReference !== null) {

View File

@ -8,5 +8,5 @@ using DHT.Utils;
namespace DHT.Utils; namespace DHT.Utils;
static class Version { static class Version {
public const string Tag = "41.0.0.0"; public const string Tag = "41.1.0.0";
} }