diff --git a/src/plugins/webhookManager.desktop/index.tsx b/src/plugins/webhookManager.desktop/index.tsx index 17b7e1bf7..82e70da16 100644 --- a/src/plugins/webhookManager.desktop/index.tsx +++ b/src/plugins/webhookManager.desktop/index.tsx @@ -8,31 +8,35 @@ import { ApplicationCommandInputType, ApplicationCommandOptionType, findOption, import { Devs } from "@utils/constants"; import { Margins } from "@utils/margins"; import { ModalContent, ModalProps, ModalRoot, ModalSize, openModal } from "@utils/modal"; -import { Button, Forms, React, Switch, TextInput } from "@webpack/common"; +import { Button, Forms, React, Switch, TextInput, useState } from "@webpack/common"; import definePlugin, { PluginNative } from "@utils/types"; const Native = VencordNative.pluginHelpers.WebhookManager as PluginNative; let url, message, username, avatarUrl = ""; let jsonMode = false; +const [params, setParams] = useState({ content: "", username: "", avatarUrl: "", url: "" }); + +const onURL = (content: string) => setParams(prev => ({ ...prev, url })); +const onContent = (content: string) => setParams(prev => ({ ...prev, content })); +const onUsername = (username: string) => setParams(prev => ({ ...prev, username })); +const onAvatar = (avatarUrl: string) => setParams(prev => ({ ...prev, avatarUrl })); + // 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; - console.log(url); // why the FUCK is it undefined. - }} + placeholder={"Webhook URL"} + value={params.url} + onChange={onURL} /> Webhook Message { - v = message; - }} + placeholder={"Content"} + value={params.content} + onChange={onContent} /> Send as Raw JSON Webhook Username { - v = username; - }} + placeholder={"Username"} + value={params.username} + onChange={onUsername} /> Webhook Avatar URL { - v = avatarUrl; - }} + placeholder={"Image URL"} + value={params.avatarUrl} + onChange={onAvatar} />