mirror of
https://github.com/Equicord/Equicord.git
synced 2025-01-18 13:23:28 -05:00
Temp Fix
This commit is contained in:
parent
3120b61bd6
commit
78ce870d14
1 changed files with 1 additions and 4 deletions
|
@ -25,17 +25,14 @@ import { findByPropsLazy } from "@webpack";
|
|||
import { Forms, MessageStore, UserStore } from "@webpack/common";
|
||||
import { Channel, Message } from "discord-types/general";
|
||||
|
||||
import { loggedMessages } from "../messageLoggerEnhanced/LoggedMessageManager";
|
||||
|
||||
const MessageActions = findByPropsLazy("deleteMessage", "startEditMessage");
|
||||
|
||||
async function deleteMessages(amount: number, channel: Channel, delay: number = 1500): Promise<number> {
|
||||
let deleted = 0;
|
||||
const userId = UserStore.getCurrentUser().id;
|
||||
const messages: Message[] = JSON.parse(JSON.stringify(MessageStore.getMessages(channel.id)._array.filter((m: Message) => m.author.id === userId).reverse()));
|
||||
const uniqueMessages: Message[] = !loggedMessages.deletedMessages[channel.id] ? messages : messages.filter(message => !loggedMessages.deletedMessages[channel.id].includes(message.id));
|
||||
|
||||
for (const message of uniqueMessages) {
|
||||
for (const message of messages) {
|
||||
MessageActions.deleteMessage(channel.id, message.id);
|
||||
amount--;
|
||||
deleted++;
|
||||
|
|
Loading…
Reference in a new issue