mirror of
https://github.com/Vendicated/Vencord.git
synced 2025-01-09 17:36:23 +00:00
don't add duplicate msgs
This commit is contained in:
parent
a12ca5b04f
commit
a8016f1bfe
1 changed files with 4 additions and 1 deletions
|
@ -43,21 +43,24 @@ let madeComponent = false;
|
|||
function findReplies(message: Message) {
|
||||
const messages: Array<Message & {
|
||||
deleted?: boolean;
|
||||
}> = [...MessageStore.getMessages(message.channel_id)?._array ?? []].filter(m => !m.deleted).sort((a, b) => a.timestamp.getTime()-b.timestamp.getTime()); // Need to deep copy Message array when sorting
|
||||
}> = [...MessageStore.getMessages(message.channel_id)?._array ?? []].filter(m => !m.deleted).sort((a, b) => a.timestamp.getTime() - b.timestamp.getTime()); // Need to deep copy Message array when sorting
|
||||
const found: Message[] = [];
|
||||
for (const other of messages) {
|
||||
if (new Date(other.timestamp.toString()).getTime() <= new Date(message.timestamp.toString()).getTime()) continue;
|
||||
if (other.messageReference?.message_id === message.id) {
|
||||
found.push(other);
|
||||
continue;
|
||||
}
|
||||
if (Vencord.Settings.plugins.FindReply.includePings) {
|
||||
if (other.content?.includes(`<@${message.author.id}>`)) {
|
||||
found.push(other);
|
||||
continue;
|
||||
}
|
||||
}
|
||||
if (Vencord.Settings.plugins.FindReply.includeAuthor) {
|
||||
if (messages.find(m => m.id === other.messageReference?.message_id)?.author.id === message.author.id) {
|
||||
found.push(other);
|
||||
continue;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue