diff --git a/src/plugins/webhookManager.desktop/index.tsx b/src/plugins/webhookManager.desktop/index.tsx index 976b541d1..ce219d897 100644 --- a/src/plugins/webhookManager.desktop/index.tsx +++ b/src/plugins/webhookManager.desktop/index.tsx @@ -7,39 +7,53 @@ import { ApplicationCommandInputType, ApplicationCommandOptionType, findOption, sendBotMessage } from "@api/Commands"; import { Devs } from "@utils/constants"; import { Margins } from "@utils/margins"; -import { ModalContent, ModalHeader, ModalProps, ModalRoot, ModalSize, openModal, openModalLazy } from "@utils/modal"; +import { ModalContent, ModalProps, ModalRoot, ModalSize, openModal } from "@utils/modal"; import { Button, Forms, React, TextInput } from "@webpack/common"; import definePlugin, { PluginNative } from "@utils/types"; const Native = VencordNative.pluginHelpers.WebhookManager as PluginNative; +let url, message, username, avatar_url = ""; -// TODO: Create Modal and add stuff +// TODO: fix webhooks not sending, fix probable undefined when null issue, add sending as raw again (wanted to make it a checkbox but i cant find checkbox) function WebhookMessageModal(props: ModalProps) { return + Webhook URL + { + v = url; + }} + /> Webhook Message { - // content = value; + v = message; }} /> Webhook Username { - // content = value; + v = username; }} /> Webhook Avatar URL { - // content = value; + v = avatar_url; }} /> ; @@ -130,33 +144,8 @@ export default definePlugin({ name: "webhook send", description: "Send a message through a webhook.", inputType: ApplicationCommandInputType.BUILT_IN, - options: [ - { - name: "url", - description: "The URL of the webhook", - type: ApplicationCommandOptionType.STRING, - required: true - } - ], - async execute(option, ctx) { - const webhookUrl = findOption(option, "url", ""); - const content = findOption(option, "content", ""); - const avatarUrl = findOption(option, "avatar-url"); - const username = findOption(option, "username"); - + async execute(_, ctx) { openModal(props => ); - - if (findOption(option, "raw")) { - Native.executeWebhook(webhookUrl, { - webhookMessage: content - }); - } else { - Native.executeWebhook(webhookUrl, { - content: content, - username: username, - avatar_url: avatarUrl - }); - } sendBotMessage(ctx.channel.id, { content: "Your webhook message has been executed." });