import ErrorBoundary from "@components/ErrorBoundary"; import { openModal, ModalRoot, ModalSize, ModalHeader, ModalCloseButton, ModalContent, closeModal, closeAllModals } from "@utils/modal"; import { Button, Forms, Parser, TextInput } from "@webpack/common"; import { cl } from "plugins/memberCount"; import { SelectedChannelStore, useState } from "@webpack/common"; import "./style.css"; import { sendMessage } from "@utils/discord"; export function showPrefefinedDurationModal(duration: string, id: string) { let reason = ""; openModal(props => <> Mute user { reason = v; }} placeholder="Reason" className="vc-punishcommands-reason" /> { sendMessage(SelectedChannelStore.getChannelId(), { content: `+Cg ${id} ${duration} ${reason}` }); closeAllModals(); }}>Mute > ); } export function showCustomDurationModal(id: string) { let duration = ""; let reason = ""; let pendingSend = false; openModal(props => <> Mute user { duration = v; }} placeholder="Duration (as written in the command)" className="vc-punishcommands-duration-c" /> { reason = v; }} placeholder="Reason" className="vc-punishcommands-reason-c" /> { if (pendingSend) return; pendingSend = true; sendMessage(SelectedChannelStore.getChannelId(), { content: `+Cg ${id} ${duration} ${reason}` }); closeAllModals(); }}>Mute > ); }