mirror of
https://github.com/chylex/Discord-History-Tracker.git
synced 2025-04-13 07:17:12 +03:00
Release BETA v.16
This commit is contained in:
parent
3c363fef23
commit
f237cfa8b7
File diff suppressed because one or more lines are too long
@ -1,6 +1,6 @@
|
||||
// ==UserScript==
|
||||
// @name Discord History Tracker
|
||||
// @version BETA v.15
|
||||
// @version BETA v.16
|
||||
// @license MIT
|
||||
// @namespace https://chylex.com
|
||||
// @homepageURL https://dht.chylex.com/
|
||||
@ -563,7 +563,7 @@ ${radio("asm", "pause", "Pause Tracking")}
|
||||
${radio("asm", "switch", "Switch to Next Channel")}
|
||||
<p id='dht-cfg-note'>
|
||||
It is recommended to disable link and image previews to avoid putting unnecessary strain on your browser.<br><br>
|
||||
<sub>BETA v.15, released 11 Sep 2019</sub>
|
||||
<sub>BETA v.16, released 19 Sep 2019</sub>
|
||||
</p>`);
|
||||
|
||||
// elements
|
||||
@ -653,14 +653,14 @@ It is recommended to disable link and image previews to avoid putting unnecessar
|
||||
* <discord message id>: {
|
||||
* u: <user index of the sender>,
|
||||
* t: <message timestamp>,
|
||||
* m: <message content>,
|
||||
* m: <message content>, // only present if not empty
|
||||
* f: <message flags>, // only present if edited in which case it equals 1, deprecated (use 'te' instead),
|
||||
* te: <edit timestamp>, // only present if edited,
|
||||
* e: [ // omit for no embeds
|
||||
* {
|
||||
* url: <embed url>,
|
||||
* type: <embed type>,
|
||||
* t: <rich embed title>, // only present if type == rich, may be empty
|
||||
* t: <rich embed title>, // only present if type == rich, and if not empty
|
||||
* d: <rich embed description> // only present if type == rich, and if the embed has a simple description text
|
||||
* }, ...
|
||||
* ],
|
||||
@ -782,12 +782,15 @@ class SAVEFILE{
|
||||
convertToMessageObject(discordMessage){
|
||||
var obj = {
|
||||
u: this.findOrRegisterUser(discordMessage.author.id, discordMessage.author.username),
|
||||
t: +discordMessage.timestamp.toDate(),
|
||||
m: discordMessage.content
|
||||
t: discordMessage.timestamp.toDate().getTime()
|
||||
};
|
||||
|
||||
if (discordMessage.content.length > 0){
|
||||
obj.m = discordMessage.content;
|
||||
}
|
||||
|
||||
if (discordMessage.editedTimestamp !== null){
|
||||
obj.te = +discordMessage.editedTimestamp.toDate();
|
||||
obj.te = discordMessage.editedTimestamp.toDate().getTime();
|
||||
}
|
||||
|
||||
if (discordMessage.embeds.length > 0){
|
||||
@ -798,16 +801,13 @@ class SAVEFILE{
|
||||
};
|
||||
|
||||
if (embed.type === "rich"){
|
||||
if (Array.isArray(embed.title) && embed.title.length === 1){
|
||||
if (Array.isArray(embed.title) && embed.title.length === 1 && typeof embed.title[0] === "string"){
|
||||
conv.t = embed.title[0];
|
||||
|
||||
if (Array.isArray(embed.description) && embed.description.length === 1){
|
||||
if (Array.isArray(embed.description) && embed.description.length === 1 && typeof embed.description[0] === "string"){
|
||||
conv.d = embed.description[0];
|
||||
}
|
||||
}
|
||||
else{
|
||||
conv.t = "";
|
||||
}
|
||||
}
|
||||
|
||||
return conv;
|
||||
@ -850,6 +850,7 @@ class SAVEFILE{
|
||||
|
||||
combineWith(obj){
|
||||
var userMap = {};
|
||||
var shownError = false;
|
||||
|
||||
for(var userId in obj.meta.users){
|
||||
userMap[obj.meta.userindex.findIndex(id => id == userId)] = this.findOrRegisterUser(userId, obj.meta.users[userId].name);
|
||||
@ -867,8 +868,23 @@ class SAVEFILE{
|
||||
var oldMessage = oldChannel[messageId];
|
||||
var oldUser = oldMessage.u;
|
||||
|
||||
oldMessage.u = userMap[oldUser] || oldUser;
|
||||
this.addMessage(channelId, messageId, oldMessage);
|
||||
if (oldUser in userMap){
|
||||
oldMessage.u = userMap[oldUser];
|
||||
this.addMessage(channelId, messageId, oldMessage);
|
||||
}
|
||||
else{
|
||||
if (!shownError){
|
||||
shownError = true;
|
||||
alert("The uploaded archive appears to be corrupted, some messages will be skipped. See console for details.");
|
||||
|
||||
console.error("User list:", obj.meta.users);
|
||||
console.error("User index:", obj.meta.userindex);
|
||||
console.error("Generated mapping:", userMap);
|
||||
console.error("Missing user for the following messages:");
|
||||
}
|
||||
|
||||
console.error(oldMessage);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
File diff suppressed because one or more lines are too long
4
build.py
4
build.py
@ -8,8 +8,8 @@ import os
|
||||
import distutils.dir_util
|
||||
|
||||
|
||||
VERSION_SHORT = "BETA v.15"
|
||||
VERSION_FULL = VERSION_SHORT + ", released 11 Sep 2019"
|
||||
VERSION_SHORT = "BETA v.16"
|
||||
VERSION_FULL = VERSION_SHORT + ", released 19 Sep 2019"
|
||||
|
||||
|
||||
EXEC_UGLIFYJS_WIN = "{2}/lib/uglifyjs.cmd --parse bare_returns --compress --mangle toplevel --mangle-props keep_quoted,reserved=[{3}] --output \"{1}\" \"{0}\""
|
||||
|
Loading…
x
Reference in New Issue
Block a user