From 623592a87ebd80c4db53502c7aa252e5c39b2160 Mon Sep 17 00:00:00 2001 From: D3SOX Date: Tue, 30 Jan 2024 22:35:15 +0100 Subject: [PATCH 1/3] fix(voiceChatUtilities): check channel type --- src/plugins/voiceChatUtilities/index.tsx | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/plugins/voiceChatUtilities/index.tsx b/src/plugins/voiceChatUtilities/index.tsx index eefdda1b41a..443f37e00bf 100644 --- a/src/plugins/voiceChatUtilities/index.tsx +++ b/src/plugins/voiceChatUtilities/index.tsx @@ -48,7 +48,8 @@ interface VoiceChannelContextProps { } const VoiceChannelContext: NavContextMenuPatchCallback = (children, { channel }: VoiceChannelContextProps) => () => { - if (!channel) return; + // only for voice and stage channels + if (!channel || (channel.type !== 2 && channel.type !== 13)) return; const guildChannels: { VOCAL: { channel: Channel, comparator: number }[] } = GuildChannelStore.getChannels(channel.guild_id); const voiceChannels = guildChannels.VOCAL.map(({ channel }) => channel).filter(({ id }) => id !== channel.id); From c6bf7fb0def53f12709ae9b86a7f535277de83eb Mon Sep 17 00:00:00 2001 From: D3SOX Date: Thu, 1 Feb 2024 01:47:22 +0100 Subject: [PATCH 2/3] chore(voiceChatUtilities): use small license header --- src/plugins/voiceChatUtilities/index.tsx | 20 ++++---------------- 1 file changed, 4 insertions(+), 16 deletions(-) diff --git a/src/plugins/voiceChatUtilities/index.tsx b/src/plugins/voiceChatUtilities/index.tsx index 443f37e00bf..c747986c9a6 100644 --- a/src/plugins/voiceChatUtilities/index.tsx +++ b/src/plugins/voiceChatUtilities/index.tsx @@ -1,20 +1,8 @@ /* - * 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 . -*/ + * Vencord, a Discord client mod + * Copyright (c) 2024 Vendicated and contributors + * SPDX-License-Identifier: GPL-3.0-or-later + */ import { addContextMenuPatch, NavContextMenuPatchCallback, removeContextMenuPatch } from "@api/ContextMenu"; import { Devs } from "@utils/constants"; From 79f4b6e8bcd807bd9d13d4860de2023c91b5d8c6 Mon Sep 17 00:00:00 2001 From: Nico Date: Fri, 2 Feb 2024 10:05:12 +0100 Subject: [PATCH 3/3] feat(voiceChatUtilities): don't show on channels without users --- src/plugins/voiceChatUtilities/index.tsx | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/plugins/voiceChatUtilities/index.tsx b/src/plugins/voiceChatUtilities/index.tsx index c747986c9a6..aa69712bb87 100644 --- a/src/plugins/voiceChatUtilities/index.tsx +++ b/src/plugins/voiceChatUtilities/index.tsx @@ -38,6 +38,9 @@ interface VoiceChannelContextProps { const VoiceChannelContext: NavContextMenuPatchCallback = (children, { channel }: VoiceChannelContextProps) => () => { // only for voice and stage channels if (!channel || (channel.type !== 2 && channel.type !== 13)) return; + const userCount = Object.keys(VoiceStateStore.getVoiceStatesForChannel(channel.id)).length; + if (userCount === 0) return; + const guildChannels: { VOCAL: { channel: Channel, comparator: number }[] } = GuildChannelStore.getChannels(channel.guild_id); const voiceChannels = guildChannels.VOCAL.map(({ channel }) => channel).filter(({ id }) => id !== channel.id);