diff --git a/server/src/index.ts b/server/src/index.ts
index 54c5ec7..834d654 100644
--- a/server/src/index.ts
+++ b/server/src/index.ts
@@ -5,7 +5,7 @@ import express, { Request, Response } from 'express';
import multer from 'multer';
import cors from 'cors';
import crypto from 'node:crypto';
-import { Client, GatewayIntentBits, Partials, ChannelType, Events, type Message, VoiceState } from 'discord.js';
+import { Client, GatewayIntentBits, Partials, ChannelType, Events, type Message, type VoiceBasedChannel, VoiceState } from 'discord.js';
import {
joinVoiceChannel,
createAudioPlayer,
@@ -1291,14 +1291,17 @@ app.get('/api/channels', (_req: Request, res: Response) => {
if (!client.isReady()) return res.status(503).json({ error: 'Bot noch nicht bereit' });
const allowed = new Set(ALLOWED_GUILD_IDS);
- const result: Array<{ guildId: string; guildName: string; channelId: string; channelName: string; selected?: boolean }> = [];
+ const result: Array<{ guildId: string; guildName: string; channelId: string; channelName: string; members: number; selected?: boolean }> = [];
for (const [, guild] of client.guilds.cache) {
if (allowed.size > 0 && !allowed.has(guild.id)) continue;
const channels = guild.channels.cache;
for (const [, ch] of channels) {
if (ch?.type === ChannelType.GuildVoice || ch?.type === ChannelType.GuildStageVoice) {
const sel = getSelectedChannelForGuild(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/App.tsx b/web/src/App.tsx
index 77f8e1d..7dc7421 100644
--- a/web/src/App.tsx
+++ b/web/src/App.tsx
@@ -610,7 +610,7 @@ export default function App() {
>
headset
{selected && }
- {selectedChannel?.channelName || 'Channel...'}
+ {selectedChannel ? `${selectedChannel.channelName}${selectedChannel.members ? ` (${selectedChannel.members})` : ''}` : 'Channel...'}
expand_more
{channelOpen && (
@@ -625,7 +625,7 @@ export default function App() {
onClick={() => handleChannelSelect(ch)}
>
volume_up
- {ch.channelName}
+ {ch.channelName}{ch.members ? ` (${ch.members})` : ''}
))}
diff --git a/web/src/types.ts b/web/src/types.ts
index 919e8fe..6222add 100644
--- a/web/src/types.ts
+++ b/web/src/types.ts
@@ -20,6 +20,7 @@ export type VoiceChannelInfo = {
guildName: string;
channelId: string;
channelName: string;
+ members?: number;
selected?: boolean;
};