mirror of
https://github.com/chylex/Discord-History-Tracker.git
synced 2025-04-14 07:37:13 +03:00
parent
f70bbd53d9
commit
ad299bf762
2
app/Resources/Tracker/bootstrap.js
vendored
2
app/Resources/Tracker/bootstrap.js
vendored
@ -117,8 +117,8 @@
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
if (!messages.length) {
|
if (!messages.length) {
|
||||||
DISCORD.loadOlderMessages();
|
|
||||||
isSending = false;
|
isSending = false;
|
||||||
|
onTrackingContinued(false);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
const anyNewMessages = await STATE.addDiscordMessages(info.id, messages);
|
const anyNewMessages = await STATE.addDiscordMessages(info.id, messages);
|
||||||
|
@ -67,14 +67,7 @@ class DISCORD {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const messages = this.getMessages();
|
const messages = this.getMessages();
|
||||||
let hasChanged = false;
|
const hasChanged = messages.some(message => !previousMessages.has(message.id)) || !this.hasMoreMessages();
|
||||||
|
|
||||||
for (const message of messages) {
|
|
||||||
if (!previousMessages.has(message.id)) {
|
|
||||||
hasChanged = true;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!hasChanged) {
|
if (!hasChanged) {
|
||||||
return;
|
return;
|
||||||
@ -140,16 +133,27 @@ class DISCORD {
|
|||||||
try {
|
try {
|
||||||
let obj;
|
let obj;
|
||||||
|
|
||||||
for (const ele of this.getMessageElements()) {
|
try {
|
||||||
const props = this.getMessageElementProps(ele);
|
for (const child of DOM.getReactProps(DOM.queryReactClass("chatContent")).children) {
|
||||||
|
if (child && child.props && child.props.channel) {
|
||||||
|
obj = child.props.channel;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} catch (e) {
|
||||||
|
console.error("[DHT] Error retrieving selected channel from 'chatContent' element.", e);
|
||||||
|
|
||||||
if (props != null) {
|
for (const ele of this.getMessageElements()) {
|
||||||
obj = props.channel;
|
const props = this.getMessageElementProps(ele);
|
||||||
break;
|
|
||||||
|
if (props != null) {
|
||||||
|
obj = props.channel;
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!obj) {
|
if (!obj || typeof obj.id !== "string") {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -215,7 +219,7 @@ class DISCORD {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
console.error(e);
|
console.error("[DHT] Error retrieving selected channel.", e);
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user