extra error handling - will add more later

This commit is contained in:
byeoon 2024-05-15 09:43:30 -04:00 committed by GitHub
parent 720aaf6f3e
commit 13119c0b29
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -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
});