Repository navigation
feat: record soundboard sounds and emoji reactions in the office - #16
Merged
Merged
Conversation
Discord only sends soundboard sounds and emoji reactions (VOICE_CHANNEL_EFFECT_SEND) to clients in the voice channel, so the bot now sits in the office while anyone is there. - It joins when the office opens and leaves when it empties, already self-muted and self-deafened. It only sends the gateway's voice-state message and never opens an audio connection. At startup it joins if people are already in, and otherwise leaves, in case an earlier run left it behind. - Each effect in the office goes to a new office.voice_effects table through the same buffered recorder: sound ID, name and volume, emoji and animation. Names come from the server's sounds, kept up to date with the GuildExpressions intent, and Discord's default sounds, fetched once at startup. Bots are left out. - A new office_activity view adds PlayedSound, Reacted and SentEffect events to voice_activity, and banter now reads it, so the model sees lines like "Alan PlayedSound airhorn". - The bot's own voice state is always treated as a bot, even when Discord leaves out the member, so it never opens the office. - It logs a warning at startup if it lacks the Connect permission on the office channel.
The gateway now drops every voice-state update and voice effect from the bot's own user ID before anything else sees them. Before, the bot was only left out by the general bot check, which relied on Discord sending the member with the update.
- The bot remembers whether it should be in the office and goes back there whenever its Discord connection is ready or resumed. Before, a fresh gateway session dropped it from voice until the office next opened, and a move tried while reconnecting was lost. - A member's display name is no longer overwritten with their user ID when Discord sends an update or effect without the member.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What and why
Records the soundboard sounds and emoji reactions people send in the office voice channel, and lets banter see them.
Discord only sends these (
VOICE_CHANNEL_EFFECT_SEND) to clients that are in the voice channel. Nothing in the REST API or the audit log has them, so the bot now sits in the office while anyone is there:office.voice_effectstable through the same buffered recorder: sound ID, name and volume, emoji and animation. Names come from the server's sounds (kept up to date with the non-privilegedGuildExpressionsintent) and Discord's default sounds (fetched once at startup). Bots are left out.office_activityview addsPlayedSound <name>,Reacted <emoji>andSentEffectevents tovoice_activity. Banter now reads that view, and the prompt explains the new events.Migration
0003_record_voice_effectsonly adds a table, indexes and a view.Before merging: give the bot the Connect permission on the office channel. Without it, everything else keeps working, but nothing gets recorded and a warning is logged.
Known limits:
voice_effectsafter the deploy.How I tested it
scripts/try-banter.tswithout--call-ai: the camera-party scenario now includes soundboard lines, and the prompt renders them.Checklist
pnpm typecheck,pnpm lint,pnpm testandpnpm buildpass