From 13119c0b29e4577c992d82276e76168421876add Mon Sep 17 00:00:00 2001 From: byeoon <47872200+byeoon@users.noreply.github.com> Date: Wed, 15 May 2024 09:43:30 -0400 Subject: [PATCH] extra error handling - will add more later --- src/plugins/WebhookManager/index.tsx | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/plugins/WebhookManager/index.tsx b/src/plugins/WebhookManager/index.tsx index 86e603297..2e206a132 100644 --- a/src/plugins/WebhookManager/index.tsx +++ b/src/plugins/WebhookManager/index.tsx @@ -35,6 +35,12 @@ export default definePlugin({ await fetch("" + findOption(option, "url"), { method: "DELETE" }).then(() => sendBotMessage(ctx.channel.id, { content: "The webhook has deleted successfully." })); } catch (error) { + if (!["discord.com", "ptb.discord.com", "canary.discord.com"].includes(findOption(option, "url")) || !pathname.startsWith("/api/webhooks/")) { + sendBotMessage(ctx.channel.id, { + content: "Please input a valid webhook URL to delete." + }); + } + sendBotMessage(ctx.channel.id, { content: "There was an error deleting the webhook. Did you input a valid webhook URL? Error: " + error });