yay its undefined for some reason

This commit is contained in:
byron 2024-06-10 16:51:25 -04:00
parent 5180df743b
commit f045554bfe

View file

@ -12,7 +12,7 @@ import { Button, Forms, React, TextInput } from "@webpack/common";
import definePlugin, { PluginNative } from "@utils/types"; import definePlugin, { PluginNative } from "@utils/types";
const Native = VencordNative.pluginHelpers.WebhookManager as PluginNative<typeof import("./native")>; const Native = VencordNative.pluginHelpers.WebhookManager as PluginNative<typeof import("./native")>;
let url, message, username, avatar_url = ""; let url, message, username, 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) // 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) { function WebhookMessageModal(props: ModalProps) {
@ -23,6 +23,7 @@ function WebhookMessageModal(props: ModalProps) {
placeholder={"https://discord.com/api/webhooks/1235349630980722698/QQv06cMyTurEIU8nQsZRQMKxdmnnN6FA8Eaa9zbDqGwqeeACx9UAS6CcnVt7B3v8r8t2"} placeholder={"https://discord.com/api/webhooks/1235349630980722698/QQv06cMyTurEIU8nQsZRQMKxdmnnN6FA8Eaa9zbDqGwqeeACx9UAS6CcnVt7B3v8r8t2"}
onChange={v => { onChange={v => {
v = url; v = url;
console.log(url); // why the FUCK is it undefined.
}} }}
/> />
<Forms.FormTitle className={Margins.top20}>Webhook Message</Forms.FormTitle> <Forms.FormTitle className={Margins.top20}>Webhook Message</Forms.FormTitle>
@ -43,7 +44,7 @@ function WebhookMessageModal(props: ModalProps) {
<TextInput <TextInput
placeholder={"https://cdn.discordapp.com/emojis/1221015075922513990.png"} placeholder={"https://cdn.discordapp.com/emojis/1221015075922513990.png"}
onChange={v => { onChange={v => {
v = avatar_url; v = avatarUrl;
}} }}
/> />
<Button <Button
@ -51,7 +52,7 @@ function WebhookMessageModal(props: ModalProps) {
Native.executeWebhook(url, { Native.executeWebhook(url, {
content: message, content: message,
username: username, username: username,
avatar_url: avatar_url avatar_url: avatarUrl
}); });
}} }}
>Send Webhook</Button> >Send Webhook</Button>