From 811781036eb65d356a338b2535dccfff3fcc76b9 Mon Sep 17 00:00:00 2001
From: thororen1234 <78185467+thororen1234@users.noreply.github.com>
Date: Fri, 10 Oct 2025 21:11:51 -0400
Subject: [PATCH] =?UTF-8?q?PurgeMessages:=20=F0=9F=91=8B?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
src/equicordplugins/purgeMessages/index.tsx | 96 ---------------------
1 file changed, 96 deletions(-)
delete mode 100644 src/equicordplugins/purgeMessages/index.tsx
diff --git a/src/equicordplugins/purgeMessages/index.tsx b/src/equicordplugins/purgeMessages/index.tsx
deleted file mode 100644
index 05812e87d..000000000
--- a/src/equicordplugins/purgeMessages/index.tsx
+++ /dev/null
@@ -1,96 +0,0 @@
-/*
- * Vencord, a modification for Discord's desktop app
- * Copyright (c) 2022 Vendicated and contributors
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see .
-*/
-
-import "@equicordplugins/_misc/styles.css";
-
-import { ApplicationCommandInputType, ApplicationCommandOptionType, findOption, sendBotMessage } from "@api/Commands";
-import { Devs, EquicordDevs } from "@utils/constants";
-import definePlugin from "@utils/types";
-import { Channel, Message } from "@vencord/discord-types";
-import { Forms, MessageActions, MessageStore, UserStore } from "@webpack/common";
-
-async function deleteMessages(amount: number, channel: Channel, delay: number = 1500): Promise {
- 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()));
-
- for (const message of messages) {
- MessageActions.deleteMessage(channel.id, message.id);
- amount--;
- deleted++;
- if (amount === 0) break;
- await new Promise(resolve => setTimeout(resolve, delay));
- }
-
- return deleted;
-}
-
-export default definePlugin({
- name: "PurgeMessages",
- description: "Purges messages from a channel",
- authors: [EquicordDevs.bhop, Devs.nyx],
- settingsAboutComponent: () => <>
-
- We can't guarantee this plugin won't get you warned or banned.
-
- >,
- commands: [
- {
- name: "purge",
- description: "Purge a chosen amount of messages from a channel",
- options: [
- {
- name: "amount",
- description: "How many messages you wish to purge",
- type: ApplicationCommandOptionType.INTEGER,
- required: true
- },
- {
- name: "channel",
- description: "Channel ID you wish to purge from",
- type: ApplicationCommandOptionType.CHANNEL,
- required: false
- },
- {
- name: "delay",
- description: "Delay inbetween deleting messages",
- type: ApplicationCommandOptionType.INTEGER,
- required: false
- }
- ],
- inputType: ApplicationCommandInputType.BUILT_IN,
- execute: async (opts, ctx) => {
- const amount: number = findOption(opts, "amount", 0);
- const channel: Channel = findOption(opts, "channel", ctx.channel);
- const delay: number = findOption(opts, "delay", 1500);
-
- sendBotMessage(ctx.channel.id, {
- content: `> deleting ${amount} messages.`
- });
-
- deleteMessages(amount, channel, delay).then((deleted: number) => {
- sendBotMessage(ctx.channel.id,
- {
- content: `> deleted ${deleted} messages`
- }
- );
- });
- },
- }
- ],
-});