From a9e9571706a78beb7a857e40379988df3dab4b5f Mon Sep 17 00:00:00 2001 From: programminglaboratorys Date: Wed, 18 Sep 2024 19:48:12 +0300 Subject: [PATCH] adding StatusPresets --- src/plugins/statusPresets/index.tsx | 114 ++++++++++++++++++++++++++++ 1 file changed, 114 insertions(+) create mode 100644 src/plugins/statusPresets/index.tsx diff --git a/src/plugins/statusPresets/index.tsx b/src/plugins/statusPresets/index.tsx new file mode 100644 index 000000000..06d59a711 --- /dev/null +++ b/src/plugins/statusPresets/index.tsx @@ -0,0 +1,114 @@ +/* + * Vencord, a modification for Discord's desktop app + * Copyright (c) 2022 Vendicated and contributors + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . +*/ + +import { NavContextMenuPatchCallback } from "@api/ContextMenu"; +import { definePluginSettings } from "@api/Settings"; +import { Devs } from "@utils/constants"; +import definePlugin, { OptionType } from "@utils/types"; +import { findByPropsLazy } from "@webpack"; +import { Button, Menu, Text, Toasts } from "@webpack/common"; + +const Components = findByPropsLazy("Status"); +const StatusStyles = findByPropsLazy("statusItem"); + +const statusCrossSponding = { + "online": "rgb(35, 165, 90)" +}; + +interface Emoji { + animated: boolean; + id: bigint | null; + name: string; +} + +interface DiscordStatus { + emojiInfo: Emoji | null; + text: string; + clearAfter: string | number | null; + status: "online" | "dnd" | "idle" | "invisible"; +} + +const settings = definePluginSettings({ + StatusPresets: { + type: OptionType.COMPONENT, + description: "yaps", + component: () => { + return (yo); + }, + default: {} + } +}); + +function StatusMenuItem({ status }: { status: DiscordStatus; }) { + return ( console.log("pog")} + render={() => (
+
{status.status}
+
{status.text}
+
)} + />); +} + +function MakeContextCallback(): NavContextMenuPatchCallback { + return (children, contextMenuApiArguments) => { + children[1]?.props.children.props.children.props.children.splice(1, 0, + + {Object.values((settings.store.StatusPresets as { [k: string]: DiscordStatus; })).map(status => )} + + ); + }; +} + +export default definePlugin({ + name: "StatusPresetsS", + description: "do now and think later", + authors: [Devs.Dolfies], + settings: settings, + patches: [ + { + find: ".Messages.CUSTOM_STATUS_CLEAR_AFTER", + replacement: { + match: /\.ModalFooter,.+\.Messages\.SAVE\}\)/, + replace: "$&,$self.renderRememberButton(this.state)" + } + } + ], + contextMenus: { + "status": MakeContextCallback() + }, + renderRememberButton({ statue }: { statue: DiscordStatus; }) { + if (!statue) return; + return ; + } +});