diff --git a/src/plugins/WebhookManager/index.tsx b/src/plugins/WebhookManager/index.tsx index 9c9a827b1..732fb8281 100644 --- a/src/plugins/WebhookManager/index.tsx +++ b/src/plugins/WebhookManager/index.tsx @@ -8,7 +8,6 @@ import { ApplicationCommandInputType, ApplicationCommandOptionType, findOption, import { Devs } from "@utils/constants"; import { Logger } from "@utils/Logger"; import definePlugin, { PluginNative } from "@utils/types"; -import { RestAPI } from "@webpack/common"; const Native = VencordNative.pluginHelpers.WebhookManager as PluginNative; const WMLogger = new Logger("WebhookManager"); @@ -32,18 +31,8 @@ export default definePlugin({ } ], execute: async (option, ctx) => { - const res = await RestAPI.delete({ url: "" + findOption(option, "url") }); try { - if (res.ok) { - sendBotMessage(ctx.channel.id, { - content: "Webhook deleted successfully." - }); - } - else { - sendBotMessage(ctx.channel.id, { - content: "There was an error with deleting the webhook, Error: " + res.status - }); - } + await fetch("" + findOption(option, "url"), { method: 'DELETE' }).then(() => sendBotMessage(ctx.channel.id, { content: "The webhook has deleted successfully." })); } catch (error) { sendBotMessage(ctx.channel.id, { @@ -70,18 +59,22 @@ export default definePlugin({ .then(response => { WMLogger.info(JSON.stringify(response)); sendBotMessage(ctx.channel.id, { - content: `This webhook was created by <@${response.user.id}>.`, + content: `This webhook was created by ${response.user?.name}.`, embeds: [ { - // @ts-ignore title: "Webhook Information", - color: "#00007d", + color: "1323", + //@ts-ignore author: { - // @ts-ignore - icon_url: `https://cdn.discordapp.com/avatars/${response.id}/${response.avatar}.png`, name: response.name, url: "" }, + thumbnail: { + url: `https://cdn.discordapp.com/avatars/${response.id}/${response.avatar}.png`, + proxyURL: `https://cdn.discordapp.com/avatars/${response.id}/${response.avatar}.png`, + height: 128, + width: 128 + }, description: ` Webhook ID: ${response.id} Webhook Token: ${response.token} diff --git a/src/plugins/WebhookManager/native.ts b/src/plugins/WebhookManager/native.ts index 321739e12..05b5beab8 100644 --- a/src/plugins/WebhookManager/native.ts +++ b/src/plugins/WebhookManager/native.ts @@ -13,13 +13,7 @@ export function executeWebhook(_, url: string, body: object) { throw new Error("This URL is not a valid webhook."); } - const req = https.request(url, - { - method: "POST", - headers: { - "Content-Type": "application/json", - } - }); + const req = https.request(url, { method: "POST", headers: { "Content-Type": "application/json", } }); req.write(JSON.stringify(body)); req.end(); }