Read voice presence from the bot's own LiveKit room
The panel still claimed it could not see anyone in voice while the bot and the user were sitting in the same channel: Stoat's gateway does not send voice states to bots, so the SDK's participant list stays empty no matter what. While the bot is connected its LiveKit room knows exactly who is there, so that is now consulted alongside the SDK — presence is reported as known, the panel names the channel the user is in, and the listener rule has real data to work with instead of falling back to trust. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 5
parent
c7f2080604
commit
ec50e4c4df
@@ -262,6 +262,16 @@ export class GuildPlayer extends EventEmitter<GuildPlayerEvents> {
|
||||
* participant name, so nobody is ever dropped and the channel never looks
|
||||
* empty — the bot would sit in it forever.
|
||||
*/
|
||||
/** Whether this user is in the channel the bot is sitting in, per LiveKit. */
|
||||
hasParticipant(userId: string): boolean {
|
||||
const participants = this.connection?.room?.remoteParticipants;
|
||||
if (!participants) return false;
|
||||
for (const participant of participants.values()) {
|
||||
if (participant.identity === userId) return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
private listenersInChannel(): number {
|
||||
return this.connection?.room?.remoteParticipants?.size ?? 0;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user