From 37ff06f928f3ffe75829e290aace5265670b8c85 Mon Sep 17 00:00:00 2001 From: Jake <134332787+justjxke@users.noreply.github.com> Date: Sat, 13 Sep 2025 06:29:36 +0100 Subject: [PATCH] NewGuildSettings: Collapsed VCs * Add VC collapse feature * Remove comments * default false --------- Co-authored-by: thororen1234 <78185467+thororen1234@users.noreply.github.com> Co-authored-by: justjxke --- src/plugins/newGuildSettings/index.tsx | 35 +++++++++++++++++++++++++- 1 file changed, 34 insertions(+), 1 deletion(-) diff --git a/src/plugins/newGuildSettings/index.tsx b/src/plugins/newGuildSettings/index.tsx index 82d5805e4..c09f3496a 100644 --- a/src/plugins/newGuildSettings/index.tsx +++ b/src/plugins/newGuildSettings/index.tsx @@ -26,7 +26,7 @@ import { Devs } from "@utils/constants"; import definePlugin, { OptionType } from "@utils/types"; import { Guild } from "@vencord/discord-types"; import { findByCodeLazy, findByPropsLazy, mapMangledModuleLazy } from "@webpack"; -import { Menu } from "@webpack/common"; +import { FluxDispatcher, GuildChannelStore, Menu } from "@webpack/common"; const { updateGuildNotificationSettings } = findByPropsLazy("updateGuildNotificationSettings"); const { toggleShowAllChannels } = mapMangledModuleLazy(".onboardExistingMember(", { @@ -82,6 +82,11 @@ const settings = definePluginSettings({ description: "Mute Mobile Push Notifications automatically", type: OptionType.BOOLEAN, default: true + }, + voiceChannels: { + description: "Hide names in Voice channels automatically", + type: OptionType.BOOLEAN, + default: false } }); @@ -99,8 +104,30 @@ const makeContextMenuPatch: (shouldAddIcon: boolean) => NavContextMenuPatchCallb ); }; +function applyVoiceNameHidingToGuild(guildId: string) { + if (!settings.store.voiceChannels) return; + + try { + const channels = GuildChannelStore.getChannels(guildId); + if (!channels?.VOCAL) return; + + channels.VOCAL.forEach(({ channel }: { channel: { id: string; type: number; }; }) => { + if (channel.type === 2) { + FluxDispatcher.dispatch({ + type: "CHANNEL_COLLAPSE", + channelId: channel.id, + collapsed: true + }); + } + }); + } catch (error) { + console.warn("[NewGuildSettings] Error applying voice name hiding:", error); + } +} + function applyDefaultSettings(guildId: string | null) { if (guildId === "@me" || guildId === "null" || guildId == null) return; + updateGuildNotificationSettings(guildId, { muted: settings.store.guild, @@ -110,15 +137,21 @@ function applyDefaultSettings(guildId: string | null) { mute_scheduled_events: settings.store.events, notify_highlights: settings.store.highlights ? 1 : 0 }); + if (settings.store.messages !== 3) { updateGuildNotificationSettings(guildId, { message_notifications: settings.store.messages, }); } + if (settings.store.showAllChannels && isOptInEnabledForGuild(guildId)) { toggleShowAllChannels(guildId); } + + if (settings.store.voiceChannels) { + applyVoiceNameHidingToGuild(guildId); + } } export default definePlugin({