mirror of
https://github.com/Vendicated/Vencord.git
synced 2024-09-20 06:30:35 +00:00
/webhookinfo has the ability to get a pingable version of the creator, webhook deletion now can determine if the URL is valid
This commit is contained in:
parent
369f66e810
commit
3dd65d520e
1 changed files with 17 additions and 14 deletions
|
@ -27,20 +27,23 @@ export default definePlugin({
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
execute: async (option, ctx) => {
|
execute: async (option, ctx) => {
|
||||||
|
const res = await RestAPI.delete(findOption(option, "url"));
|
||||||
// const res = await REST.delete(findOption(option, "url"));
|
|
||||||
try {
|
try {
|
||||||
await RestAPI.delete({
|
if (res.ok == true) {
|
||||||
url: "" + findOption(option, "url")
|
sendBotMessage(ctx.channel.id, {
|
||||||
});
|
content: "Webhook deleted successfully."
|
||||||
sendBotMessage(ctx.channel.id, {
|
});
|
||||||
content: "Webhook deleted successfully."
|
}
|
||||||
});
|
else {
|
||||||
|
console.log("WebhookManager encountered an error deleting a webhook. " + res.status);
|
||||||
|
sendBotMessage(ctx.channel.id, {
|
||||||
|
content: "There was an error deleting the webhook. Check the console for more info."
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
catch
|
catch (error) {
|
||||||
{
|
|
||||||
sendBotMessage(ctx.channel.id, {
|
sendBotMessage(ctx.channel.id, {
|
||||||
content: "Webhook NOT deleted successfully."
|
content: "There was an error deleting the webhook. Did you input a valid webhook URL?"
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -58,8 +61,8 @@ export default definePlugin({
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
execute: async (option, ctx) => {
|
execute: async (option, ctx) => {
|
||||||
var webhookthing = findOption(option, "url");
|
var webhookUrl = findOption(option, "url");
|
||||||
await fetch("" + webhookthing).then(response => response.json())
|
await fetch("" + webhookUrl).then(response => response.json())
|
||||||
.then(response => {
|
.then(response => {
|
||||||
sendBotMessage(ctx.channel.id, {
|
sendBotMessage(ctx.channel.id, {
|
||||||
content: "# Webhook Information: \n" +
|
content: "# Webhook Information: \n" +
|
||||||
|
@ -73,7 +76,7 @@ export default definePlugin({
|
||||||
|
|
||||||
"# Webhook Creator Information: \n " +
|
"# Webhook Creator Information: \n " +
|
||||||
"Creator UserID: " + response.user.id + "\n " +
|
"Creator UserID: " + response.user.id + "\n " +
|
||||||
"Creator Username: " + response.user.name + "\n " +
|
"Creator Username: " + response.username + " | ( <@" + res.user.id + "> )" + "\n " +
|
||||||
"Creator Profile: [Click Me](https://img.discord.dog/" + response.user.id + ") \n"
|
"Creator Profile: [Click Me](https://img.discord.dog/" + response.user.id + ") \n"
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in a new issue