From 09331c12c9c440814e5feed8e646be5d77070c6e Mon Sep 17 00:00:00 2001 From: thororen1234 <78185467+thororen1234@users.noreply.github.com> Date: Fri, 16 Aug 2024 02:05:44 -0400 Subject: [PATCH] Why is every other match of this not conflicting --- .../soundBoardLogger/index.tsx | 27 ++--- src/plugins/showConnections/index.tsx | 8 -- .../components/VoiceChannelSection.css | 27 ----- .../components/VoiceChannelSection.tsx | 61 ---------- src/plugins/userVoiceShow/index.tsx | 114 ------------------ 5 files changed, 12 insertions(+), 225 deletions(-) delete mode 100644 src/plugins/userVoiceShow/components/VoiceChannelSection.css delete mode 100644 src/plugins/userVoiceShow/components/VoiceChannelSection.tsx delete mode 100644 src/plugins/userVoiceShow/index.tsx diff --git a/src/equicordplugins/soundBoardLogger/index.tsx b/src/equicordplugins/soundBoardLogger/index.tsx index 32a0aea6..4cb22549 100644 --- a/src/equicordplugins/soundBoardLogger/index.tsx +++ b/src/equicordplugins/soundBoardLogger/index.tsx @@ -21,17 +21,14 @@ import { getListeners } from "./utils"; const HeaderBarIcon = findExportedComponentLazy("Icon", "Divider"); -function ToolBarHeader() { +function OpenLogsButton() { return ( - - } - onClick={openSoundBoardLog} - /> - + openSoundBoardLog()} + tooltip={"Open SoundBoard Log"} + icon={} + /> ); } @@ -45,7 +42,7 @@ export default definePlugin({ find: "toolbar:function", replacement: { match: /(function \i\(\i\){)(.{1,200}toolbar.{1,100}mobileToolbar)/, - replace: "$1$self.toolbarAction(arguments[0]);$2" + replace: "$1$self.addIconToToolBar(arguments[0]);$2" } } ], @@ -63,19 +60,19 @@ export default definePlugin({ disableStyle(styles); if (settings.store.IconLocation === "chat") removeChatBarButton("vc-soundlog-button"); }, - toolbarAction(e) { + addIconToToolBar(e: { toolbar: React.ReactNode[] | React.ReactNode; }) { if (Array.isArray(e.toolbar)) return e.toolbar.push( - + ); e.toolbar = [ - + , e.toolbar, ]; - }, + } }); diff --git a/src/plugins/showConnections/index.tsx b/src/plugins/showConnections/index.tsx index 4c9becde..440e76a8 100644 --- a/src/plugins/showConnections/index.tsx +++ b/src/plugins/showConnections/index.tsx @@ -188,14 +188,6 @@ export default definePlugin({ description: "Show connected accounts in user popouts", authors: [Devs.TheKodeToad], patches: [ - { - find: ".PROFILE_PANEL,", - replacement: { - // createElement(Divider, {}), createElement(NoteComponent) - match: /\(0,\i\.jsx\)\(\i\.\i,\{\}\).{0,100}setNote:(?=.+?channelId:(\i).id)/, - replace: "$self.profilePanelComponent({ id: $1.recipients[0] }),$&" - } - }, { find: '"BiteSizeProfileBody"', replacement: { diff --git a/src/plugins/userVoiceShow/components/VoiceChannelSection.css b/src/plugins/userVoiceShow/components/VoiceChannelSection.css deleted file mode 100644 index 00ecf5d4..00000000 --- a/src/plugins/userVoiceShow/components/VoiceChannelSection.css +++ /dev/null @@ -1,27 +0,0 @@ -.vc-uvs-button>div { - white-space: normal !important; -} - -.vc-uvs-button { - width: 100%; - margin: auto; - height: unset; -} - -.vc-uvs-header { - color: var(--header-primary); - margin-bottom: 6px; -} - -.vc-uvs-modal-margin { - margin: 0 12px; -} - -.vc-uvs-modal-margin div { - margin-bottom: 0 !important; -} - -.vc-uvs-popout-margin-self>[class^="section"] { - padding-top: 0; - padding-bottom: 12px; -} diff --git a/src/plugins/userVoiceShow/components/VoiceChannelSection.tsx b/src/plugins/userVoiceShow/components/VoiceChannelSection.tsx deleted file mode 100644 index c1bcbd65..00000000 --- a/src/plugins/userVoiceShow/components/VoiceChannelSection.tsx +++ /dev/null @@ -1,61 +0,0 @@ -/* - * Vencord, a modification for Discord's desktop app - * Copyright (c) 2023 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 "./VoiceChannelSection.css"; - -import { findByCodeLazy, findByPropsLazy } from "@webpack"; -import { Button, Forms, PermissionStore, Toasts } from "@webpack/common"; -import { Channel } from "discord-types/general"; - -const ChannelActions = findByPropsLazy("selectChannel", "selectVoiceChannel"); -const UserPopoutSection = findByCodeLazy(".lastSection", "children:"); - -const CONNECT = 1n << 20n; - -interface VoiceChannelFieldProps { - channel: Channel; - label: string; - showHeader: boolean; -} - -export const VoiceChannelSection = ({ channel, label, showHeader }: VoiceChannelFieldProps) => ( - - {showHeader && In a voice channel} - - -); diff --git a/src/plugins/userVoiceShow/index.tsx b/src/plugins/userVoiceShow/index.tsx deleted file mode 100644 index 7d640171..00000000 --- a/src/plugins/userVoiceShow/index.tsx +++ /dev/null @@ -1,114 +0,0 @@ -/* - * Vencord, a modification for Discord's desktop app - * Copyright (c) 2023 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 { definePluginSettings } from "@api/Settings"; -import ErrorBoundary from "@components/ErrorBoundary"; -import { Devs } from "@utils/constants"; -import definePlugin, { OptionType } from "@utils/types"; -import { findStoreLazy } from "@webpack"; -import { ChannelStore, GuildStore, UserStore } from "@webpack/common"; -import { User } from "discord-types/general"; - -import { VoiceChannelSection } from "./components/VoiceChannelSection"; - -const VoiceStateStore = findStoreLazy("VoiceStateStore"); - -const settings = definePluginSettings({ - showInUserProfileModal: { - type: OptionType.BOOLEAN, - description: "Show a user's voice channel in their profile modal", - default: true, - }, - showVoiceChannelSectionHeader: { - type: OptionType.BOOLEAN, - description: 'Whether to show "IN A VOICE CHANNEL" above the join button', - default: true, - } -}); - -interface UserProps { - user: User; -} - -const VoiceChannelField = ErrorBoundary.wrap(({ user }: UserProps) => { - const { channelId } = VoiceStateStore.getVoiceStateForUser(user.id) ?? {}; - if (!channelId) return null; - - const channel = ChannelStore.getChannel(channelId); - if (!channel) return null; - - const guild = GuildStore.getGuild(channel.guild_id); - - if (!guild) return null; // When in DM call - - const result = `${guild.name} | ${channel.name}`; - - return ( - - ); -}); - -export default definePlugin({ - name: "UserVoiceShow", - description: "Shows whether a User is currently in a voice channel somewhere in their profile", - authors: [Devs.LordElias], - settings, - - patchModal({ user }: UserProps) { - if (!settings.store.showInUserProfileModal) - return null; - - return ( -
- -
- ); - }, - - patchPopout: ({ user }: UserProps) => { - const isSelfUser = user.id === UserStore.getCurrentUser().id; - return ( -
- -
- ); - }, - - patches: [ - // above message box - { - find: ".popularApplicationCommandIds,", - replacement: { - match: /(?<=,)(?=!\i&&!\i&&.{0,50}setNote:)/, - replace: "$self.patchPopout(arguments[0]),", - } - }, - // below username - { - find: ".Messages.MUTUAL_GUILDS_WITH_END_COUNT", // Lazy Loaded - replacement: { - match: /\.body.+?displayProfile:\i}\),/, - replace: "$&$self.patchModal(arguments[0]),", - } - } - ], -});