mirror of
https://github.com/Vendicated/Vencord.git
synced 2024-09-20 06:30:35 +00:00
hewlp vinneie vnecord no work
This commit is contained in:
parent
2cd661f7b6
commit
5e52a34205
1 changed files with 22 additions and 24 deletions
|
@ -8,35 +8,31 @@ 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, useState } from "@webpack/common";
|
||||
import { Button, Forms, React, Switch, TextInput } from "@webpack/common";
|
||||
import definePlugin, { PluginNative } from "@utils/types";
|
||||
|
||||
const Native = VencordNative.pluginHelpers.WebhookManager as PluginNative<typeof import("./native")>;
|
||||
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 <ModalRoot {...props} size={ModalSize.MEDIUM} className={"wm-send-webhook"} >
|
||||
<ModalContent className="wm-send-webhook-content">
|
||||
<Forms.FormTitle className={Margins.top20}>Webhook URL</Forms.FormTitle>
|
||||
<TextInput
|
||||
placeholder={"Webhook URL"}
|
||||
value={params.url}
|
||||
onChange={onURL}
|
||||
placeholder={"https://discord.com/api/webhooks/1235349630980722698/QQv06cMyTurEIU8nQsZRQMKxdmnnN6FA8Eaa9zbDqGwqeeACx9UAS6CcnVt7B3v8r8t2"}
|
||||
onChange={v => {
|
||||
v = url;
|
||||
console.log(url); // why the FUCK is it undefined.
|
||||
}}
|
||||
/>
|
||||
<Forms.FormTitle className={Margins.top20}>Webhook Message</Forms.FormTitle>
|
||||
<TextInput
|
||||
placeholder={"Content"}
|
||||
value={params.content}
|
||||
onChange={onContent}
|
||||
placeholder={"Hello World!"}
|
||||
onChange={v => {
|
||||
v = message;
|
||||
}}
|
||||
/>
|
||||
<Switch
|
||||
key="wm-raw"
|
||||
|
@ -48,22 +44,24 @@ function WebhookMessageModal(props: ModalProps) {
|
|||
>Send as Raw JSON</Switch>
|
||||
<Forms.FormTitle className={Margins.top20}>Webhook Username</Forms.FormTitle>
|
||||
<TextInput
|
||||
placeholder={"Username"}
|
||||
value={params.username}
|
||||
onChange={onUsername}
|
||||
placeholder={"byeoon"}
|
||||
onChange={v => {
|
||||
v = username;
|
||||
}}
|
||||
/>
|
||||
<Forms.FormTitle className={Margins.top20}>Webhook Avatar URL</Forms.FormTitle>
|
||||
<TextInput
|
||||
placeholder={"Image URL"}
|
||||
value={params.avatarUrl}
|
||||
onChange={onAvatar}
|
||||
placeholder={"https://cdn.discordapp.com/emojis/1221015075922513990.png"}
|
||||
onChange={v => {
|
||||
v = avatarUrl;
|
||||
}}
|
||||
/>
|
||||
<Button
|
||||
onClick={() => {
|
||||
Native.executeWebhook(params.url, {
|
||||
content: params.content,
|
||||
username: params.username,
|
||||
avatar_url: params.avatarUrl
|
||||
Native.executeWebhook(url, {
|
||||
content: message,
|
||||
username: username,
|
||||
avatar_url: avatarUrl
|
||||
});
|
||||
}}
|
||||
>Send Webhook</Button>
|
||||
|
|
Loading…
Reference in a new issue