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 <noreply@anthropic.com>
This commit is contained in:
parent
9aefc3d470
commit
dd71d763cd
2 changed files with 8 additions and 4 deletions
|
|
@ -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 });
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue