Stop the listener rule from locking people out on stale presence

The panel said "you are not in a voice channel" while the client showed
the user sitting in the call, which also disabled the only button that
could summon the bot. The SDK learns voice participants from gateway
events alone — no endpoint to ask — so a bot that restarted, or missed a
VoiceChannelJoin, sees every channel as empty forever, and that looks
exactly like nobody listening.

The rule now refuses only on proven absence: when the bot can see people
in voice somewhere in the server and the requester is not among them.
With no presence data at all it accepts an explicitly chosen channel and
logs that it is trusting the request, and the panel falls back to the
channel picker instead of a dead button.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
Leonid Pershin
2026-09-09 02:34:54 +03:00
co-authored by Claude Opus 5
parent 0b17b880d6
commit 224d5679a3
6 changed files with 48 additions and 8 deletions
+1
View File
@@ -17,6 +17,7 @@ const context = {
getVoiceChannel: (id) => ({ id, name: "General" }),
listVoiceChannels: () => [{ id: "vc1", name: "General" }],
findUserVoiceChannel: () => ({ id: "vc1", name: "General" }),
hasVoicePresence: () => true,
listServersForUser: async () => [{ id: "srv1", name: "Test Server", iconUrl: null }],
isMember: async (s, u) => s === "srv1" && u === "user1",
canControl: async () => true,