From dd71d763cd7e163279e86e9ee4178307e6cbe6b8 Mon Sep 17 00:00:00 2001 From: Daniel Date: Fri, 6 Mar 2026 20:02:00 +0100 Subject: [PATCH] Feat: Show member count in soundboard channel dropdown Add voice channel member count (non-bot users) to soundboard channel API response and display it in the dropdown, matching the radio plugin's existing behavior. Co-Authored-By: Claude Opus 4.6 --- server/src/plugins/soundboard/index.ts | 7 +++++-- web/src/plugins/soundboard/SoundboardTab.tsx | 5 +++-- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/server/src/plugins/soundboard/index.ts b/server/src/plugins/soundboard/index.ts index 70020c4..8935942 100644 --- a/server/src/plugins/soundboard/index.ts +++ b/server/src/plugins/soundboard/index.ts @@ -14,7 +14,7 @@ import { } from '@discordjs/voice'; import sodium from 'libsodium-wrappers'; import nacl from 'tweetnacl'; -import { ChannelType, Events, type VoiceState, type Message } from 'discord.js'; +import { ChannelType, Events, type VoiceBasedChannel, type VoiceState, type Message } from 'discord.js'; import type { Plugin, PluginContext } from '../../core/plugin.js'; import { sseBroadcast } from '../../core/sse.js'; @@ -773,7 +773,10 @@ const soundboardPlugin: Plugin = { for (const [, ch] of guild.channels.cache) { if (ch?.type === ChannelType.GuildVoice || ch?.type === ChannelType.GuildStageVoice) { const sel = persistedState.selectedChannels?.[guild.id]; - result.push({ guildId: guild.id, guildName: guild.name, channelId: ch.id, channelName: ch.name, selected: sel === ch.id }); + const members = ('members' in ch) + ? (ch as VoiceBasedChannel).members.filter(m => !m.user.bot).size + : 0; + result.push({ guildId: guild.id, guildName: guild.name, channelId: ch.id, channelName: ch.name, members, selected: sel === ch.id }); } } } diff --git a/web/src/plugins/soundboard/SoundboardTab.tsx b/web/src/plugins/soundboard/SoundboardTab.tsx index 5ab4f24..887060c 100644 --- a/web/src/plugins/soundboard/SoundboardTab.tsx +++ b/web/src/plugins/soundboard/SoundboardTab.tsx @@ -27,6 +27,7 @@ type VoiceChannelInfo = { guildName: string; channelId: string; channelName: string; + members?: number; selected?: boolean; }; @@ -869,7 +870,7 @@ export default function SoundboardTab({ data }: SoundboardTabProps) { > headset {selected && } - {selectedChannel?.channelName || 'Channel...'} + {selectedChannel ? `${selectedChannel.channelName}${selectedChannel.members ? ` (${selectedChannel.members})` : ''}` : 'Channel...'} expand_more {channelOpen && ( @@ -884,7 +885,7 @@ export default function SoundboardTab({ data }: SoundboardTabProps) { onClick={() => handleChannelSelect(ch)} > volume_up - {ch.channelName} + {ch.channelName}{ch.members ? ` (${ch.members})` : ''} ))}