mirror of
https://github.com/chylex/Discord-History-Tracker.git
synced 2025-04-12 06:50:01 +03:00
Tweak tracking script for easier debugging
This commit is contained in:
parent
737ab43ea4
commit
f1c4cd040e
@ -117,24 +117,25 @@ class DISCORD {
|
||||
}
|
||||
}
|
||||
|
||||
static getMessagesFromSelectedChannel() {
|
||||
const channelId = this.#getCurrentlySelectedChannelId();
|
||||
return channelId ? this.#getMessages(channelId) : null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Calls the provided function with a list of messages whenever the currently loaded messages change.
|
||||
* @param callback {function(server: ?DiscordGuild, channel: DiscordChannel, messages: Array<DiscordMessage>, hasMoreBefore: boolean)}
|
||||
*/
|
||||
static setupMessageCallback(callback) {
|
||||
const previousMessages = new Set();
|
||||
|
||||
const onMessageElementsChanged = force => {
|
||||
const channelId = this.#getCurrentlySelectedChannelId();
|
||||
if (!channelId) {
|
||||
return false;
|
||||
}
|
||||
|
||||
const messages = this.#getMessages(channelId);
|
||||
const messages = this.getMessagesFromSelectedChannel();
|
||||
if (!messages || !messages.ready || messages.loadingMore) {
|
||||
return false;
|
||||
}
|
||||
|
||||
const channel = this.#channelStore.getChannel(channelId);
|
||||
const channel = this.#channelStore.getChannel(messages.channelId);
|
||||
if (!channel) {
|
||||
return false;
|
||||
}
|
||||
|
@ -73,6 +73,7 @@
|
||||
/**
|
||||
* @name MessageData
|
||||
* @type {Object}
|
||||
* @property {String} channelId
|
||||
* @property {Boolean} ready
|
||||
* @property {Boolean} loadingMore
|
||||
* @property {Boolean} hasMoreAfter
|
||||
|
Loading…
x
Reference in New Issue
Block a user