From 9e5315cbe4b5f46e74618910c2f9aebadfc1777a Mon Sep 17 00:00:00 2001 From: thororen1234 <78185467+thororen1234@users.noreply.github.com> Date: Sun, 11 Aug 2024 21:21:14 -0400 Subject: [PATCH] Drop 2 D3SOX Plugins --- README.md | 4 +- .../serverProfilesToolbox/index.tsx | 190 ------------------ .../silentTypingEnhanced/index.tsx | 177 ---------------- 3 files changed, 1 insertion(+), 370 deletions(-) delete mode 100644 src/equicordplugins/serverProfilesToolbox/index.tsx delete mode 100644 src/equicordplugins/silentTypingEnhanced/index.tsx diff --git a/README.md b/README.md index d951b030..f30bc935 100644 --- a/README.md +++ b/README.md @@ -21,7 +21,7 @@ An enhanced version of [Vencord](https://github.com/Vendicated/Vencord) by [Vend - Request for plugins from Discord.
-Extra included plugins (124 additional plugins) +Extra included plugins (122 additional plugins) - AllCallTimers by MaxHerbold and D3SOX - AltKrispSwitch by newwares @@ -116,11 +116,9 @@ An enhanced version of [Vencord](https://github.com/Vendicated/Vencord) by [Vend - ScreenRecorder by AutumnVN - SearchFix by Jaxx - SekaiStickers by MaiKokain -- ServerProfilesToolbox by D3SOX - ServerSearch by camila314 - Shakespearean by vmohammad (Dev build only) - ShowBadgesInChat by Inbestigator and KrystalSkull -- SilentTypingEnhanced by Ven, Rini, D3SOX - Slap by Korbo - SoundBoardLogger by Moxxie, fres, echo (maintained by thororen) - SteamStatusSync by niko diff --git a/src/equicordplugins/serverProfilesToolbox/index.tsx b/src/equicordplugins/serverProfilesToolbox/index.tsx deleted file mode 100644 index 1c9c87c3..00000000 --- a/src/equicordplugins/serverProfilesToolbox/index.tsx +++ /dev/null @@ -1,190 +0,0 @@ -/* - * Vencord, a Discord client mod - * Copyright (c) 2024 Vendicated and contributors - * SPDX-License-Identifier: GPL-3.0-or-later - */ - -import { Devs } from "@utils/constants"; -import definePlugin from "@utils/types"; -import { findByPropsLazy, findComponentByCodeLazy } from "@webpack"; -import { - Button, - Clipboard, - GuildMemberStore, - Text, - Toasts, - UserProfileStore, - UserStore -} from "@webpack/common"; -import { GuildMember } from "discord-types/general"; - -const SummaryItem = findComponentByCodeLazy("borderType", "showBorder", "hideDivider"); - -interface SavedProfile { - nick: string | null; - pronouns: string | null; - bio: string | null; - themeColors: number[] | undefined; - banner: string | undefined; - avatar: string | undefined; - profileEffectId: string | undefined; - avatarDecoration: string | undefined; -} - -const savedProfile: SavedProfile = { - nick: null, - pronouns: null, - bio: null, - themeColors: undefined, - banner: undefined, - avatar: undefined, - profileEffectId: undefined, - avatarDecoration: undefined, -}; - -const { - setPendingAvatar, - setPendingBanner, - setPendingBio, - setPendingNickname, - setPendingPronouns, - setPendingThemeColors, - setPendingProfileEffectId, - setPendingAvatarDecoration, -}: { - setPendingAvatar: (a: string | undefined) => void; - setPendingBanner: (a: string | undefined) => void; - setPendingBio: (a: string | null) => void; - setPendingNickname: (a: string | null) => void; - setPendingPronouns: (a: string | null) => void; - setPendingThemeColors: (a: number[] | undefined) => void; - setPendingProfileEffectId: (a: string | undefined) => void; - setPendingAvatarDecoration: (a: string | undefined) => void; -} = findByPropsLazy("setPendingNickname", "setPendingPronouns"); - -export default definePlugin({ - name: "ServerProfilesToolbox", - authors: [Devs.D3SOX], - description: "Adds a copy/paste/reset button to the server profiles editor", - - patchServerProfiles({ guildId }: { guildId: string; }) { - const currentUser = UserStore.getCurrentUser(); - const premiumType = currentUser.premiumType ?? 0; - - const copy = () => { - const profile = UserProfileStore.getGuildMemberProfile(currentUser.id, guildId); - const nick = GuildMemberStore.getNick(guildId, currentUser.id); - const selfMember = GuildMemberStore.getMember(guildId, currentUser.id) as GuildMember & { avatarDecoration: string | undefined; }; - savedProfile.nick = nick ?? ""; - savedProfile.pronouns = profile.pronouns; - savedProfile.bio = profile.bio; - savedProfile.themeColors = profile.themeColors; - savedProfile.banner = profile.banner; - savedProfile.avatar = selfMember.avatar; - savedProfile.profileEffectId = profile.profileEffectId; - savedProfile.avatarDecoration = selfMember.avatarDecoration; - }; - - const paste = () => { - setPendingNickname(savedProfile.nick); - setPendingPronouns(savedProfile.pronouns); - if (premiumType === 2) { - setPendingBio(savedProfile.bio); - setPendingThemeColors(savedProfile.themeColors); - setPendingBanner(savedProfile.banner); - setPendingAvatar(savedProfile.avatar); - setPendingProfileEffectId(savedProfile.profileEffectId); - setPendingAvatarDecoration(savedProfile.avatarDecoration); - } - }; - - const reset = () => { - setPendingNickname(null); - setPendingPronouns(""); - if (premiumType === 2) { - setPendingBio(null); - setPendingThemeColors([]); - setPendingBanner(undefined); - setPendingAvatar(undefined); - setPendingProfileEffectId(undefined); - setPendingAvatarDecoration(undefined); - } - }; - - const copyToClipboard = () => { - copy(); - Clipboard.copy(JSON.stringify(savedProfile)); - }; - - const pasteFromClipboard = async () => { - try { - const clip = await navigator.clipboard.readText(); - if (!clip) { - Toasts.show({ - message: "Clipboard is empty", - type: Toasts.Type.FAILURE, - id: Toasts.genId(), - }); - return; - } - const clipboardProfile: SavedProfile = JSON.parse(clip); - - if (!("nick" in clipboardProfile)) { - Toasts.show({ - message: "Data is not in correct format", - type: Toasts.Type.FAILURE, - id: Toasts.genId(), - }); - return; - } - - Object.assign(savedProfile, JSON.parse(clip)); - paste(); - } catch (e) { - Toasts.show({ - message: `Failed to read clipboard data: ${e}`, - type: Toasts.Type.FAILURE, - id: Toasts.genId(), - }); - } - }; - - return -
- - Use the following buttons to mange the currently selected server - -
- - - -
-
- - -
-
-
; - }, - - patches: [ - { - find: ".PROFILE_CUSTOMIZATION_GUILD_SELECT_TITLE", - replacement: { - match: /return\(0(.{10,350})\}\)\}\)\}/, - replace: "return [(0$1})}),$self.patchServerProfiles(e)]}" - } - } - ], - -}); diff --git a/src/equicordplugins/silentTypingEnhanced/index.tsx b/src/equicordplugins/silentTypingEnhanced/index.tsx deleted file mode 100644 index 309aa5cf..00000000 --- a/src/equicordplugins/silentTypingEnhanced/index.tsx +++ /dev/null @@ -1,177 +0,0 @@ -/* - * 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 { addChatBarButton, ChatBarButton, removeChatBarButton } from "@api/ChatButtons"; -import { ApplicationCommandInputType, ApplicationCommandOptionType, findOption, sendBotMessage } from "@api/Commands"; -import { definePluginSettings } from "@api/Settings"; -import { Devs } from "@utils/constants"; -import definePlugin, { OptionType } from "@utils/types"; -import { ChannelStore, FluxDispatcher, React } from "@webpack/common"; - -const settings = definePluginSettings({ - showIcon: { - type: OptionType.BOOLEAN, - default: true, - description: "Show an icon for toggling the plugin", - restartNeeded: true, - }, - isEnabled: { - type: OptionType.BOOLEAN, - description: "Toggle functionality", - default: true, - }, - specificChats: { - type: OptionType.BOOLEAN, - default: false, - description: "Disable silent typing for specific chats instead (use icon to toggle)", - restartNeeded: false, - }, - disabledFor: { - type: OptionType.STRING, - description: "Disable functionality for these chats (comma separated list of guild or user IDs)", - default: "", - }, -}); - -const SilentTypingToggle: ChatBarButton = ({ isMainChat, channel }) => { - const { isEnabled, showIcon, specificChats, disabledFor } = settings.use(["isEnabled", "showIcon", "specificChats", "disabledFor"]); - const id = channel.guild_id ?? channel.id; - - const toggleGlobal = () => { - settings.store.isEnabled = !settings.store.isEnabled; - }; - const toggle = () => { - if (specificChats) { - if (!settings.store.isEnabled) { - toggleGlobal(); - } else { - const disabledChannels = getDisabledChannelsList(disabledFor); - if (disabledChannels.includes(id)) { - disabledChannels.splice(disabledChannels.indexOf(id), 1); - } else { - disabledChannels.push(id); - } - settings.store.disabledFor = disabledChannels.join(", "); - } - } else { - toggleGlobal(); - } - }; - const shouldEnable = isEnabled && (!specificChats || !getDisabledChannelsList(disabledFor).includes(id)); - - let tooltip = shouldEnable ? "Disable Silent Typing" : "Enable Silent Typing"; - if (specificChats) { - if (!isEnabled) { - tooltip = "Re-enable Silent Typing globally"; - } else { - const chatType = channel.guild_id ? "guild" : "user"; - tooltip = shouldEnable ? `Disable Silent Typing for current ${chatType} (right-click to toggle globally)` - : `Enable Silent Typing for current ${chatType} (right-click to toggle globally)`; - } - } - - if (!isMainChat || !showIcon) return null; - - return ( - - - - {shouldEnable && - } - {specificChats && !settings.store.isEnabled && - - } - - - ); -}; - -function getDisabledChannelsList(list = settings.store.disabledFor) { - try { - return list.split(",").map(x => x.trim()).filter(Boolean); - } catch (e) { - settings.store.disabledFor = ""; - return []; - } -} - -function isEnabled(channelId: string) { - if (!settings.store.isEnabled) return false; - if (settings.store.specificChats) { - // need to resolve guild id for guild channels - const guildId = ChannelStore.getChannel(channelId)?.guild_id; - return !getDisabledChannelsList().includes(guildId ?? channelId); - } - return true; -} - -export default definePlugin({ - name: "SilentTypingEnhanced", - authors: [Devs.Ven, Devs.Rini, Devs.D3SOX], - description: "Hide that you are typing", - dependencies: ["CommandsAPI", "ChatInputButtonAPI"], - settings, - - patches: [ - { - find: '.dispatch({type:"TYPING_START_LOCAL"', - replacement: { - match: /startTyping\(\i\){.+?},stop/, - replace: "startTyping:$self.startTyping,stop" - } - }, - ], - - commands: [{ - name: "silenttype", - description: "Toggle whether you're hiding that you're typing or not.", - inputType: ApplicationCommandInputType.BUILT_IN, - options: [ - { - name: "value", - description: "whether to hide or not that you're typing (default is toggle)", - required: false, - type: ApplicationCommandOptionType.BOOLEAN, - }, - ], - execute: async (args, ctx) => { - settings.store.isEnabled = !!findOption(args, "value", !settings.store.isEnabled); - sendBotMessage(ctx.channel.id, { - content: settings.store.isEnabled ? "Silent typing enabled!" : "Silent typing disabled!", - }); - }, - }], - - async startTyping(channelId: string) { - if (isEnabled(channelId)) return; - FluxDispatcher.dispatch({ type: "TYPING_START_LOCAL", channelId }); - }, - - start: () => addChatBarButton("SilentTyping", SilentTypingToggle), - stop: () => removeChatBarButton("SilentTyping"), -});