feat(commands): improve slash-command UX#58
Open
Haibread wants to merge 2 commits into
Open
Conversation
- /help now shows the command list and template field reference instead of a placeholder - /create-primary surfaces the underlying template/Discord error so users can tell what they got wrong - Replies are now ephemeral (visible only to the invoking user) so command output no longer clutters channels - /ping and the create-primary success message use embeds with separate fields - Fix "hearbeat" typo in /ping output https://claude.ai/code/session_016tkC9bxfpYhFtrVQFp2vZa
Commands & interactions:
- Defer slow /create-primary and /delete-primary interactions so users
never see "the application did not respond" if Discord is slow
- Autocomplete the /create-primary template option with common presets
- /help takes an optional topic (commands|template) for focused output
- New /list-primaries shows registered primaries with active secondary
counts; new /delete-primary removes a managed primary (refuses if it
still has live secondaries to avoid orphaning channels)
- Consistent embed color across all replies
Bot configuration:
- New bot_activity_type config (Playing/Listening/Watching/Competing/
Streaming) so the bot's status verb is no longer hard-coded
Live name updates:
- New presence-update handler triggers an immediate rename when a user's
game changes; both it and the periodic sweep go through one per-channel
throttle so we stay within Discord's 2-renames-per-10-min limit
- Throttle entries are cleared when a secondary channel is deleted so the
map doesn't accumulate dead IDs
Template engine:
- {{.PartySize}} now returns the real voice-state user count instead of
the "N/A" placeholder
- getNamefromTemplate split into resolveGameName / resolvePartySize /
parentChannelID; error paths return early instead of falling through
- getMainActivity tie-breaks deterministically (count desc, name asc)
via a new pure mostCommon helper, with unit tests
- Nil-presence guards in getMainActivity / getMainActivityUser
Docs:
- README config table includes bot_activity_type
- README troubleshooting section covers presence intent, rename rate
limits, missing bot permissions, refusal to delete primaries with
live secondaries, and template parse errors
https://claude.ai/code/session_016tkC9bxfpYhFtrVQFp2vZa
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.
Summary
Polish the user-facing surface of the bot — the slash commands.
/helpnow shows the command list and template field reference instead of a placeholder. Sourced from a newchannels.TemplateHelpconstant so the field list has a single source of truth./create-primarysurfaces the underlying error (template parse/execute error, Discord API error on creation) instead of collapsing every failure to "An error occurred while testing the template", so users can tell which field is broken and why.MessageFlagsEphemeral) — command output no longer clutters the channel for everyone./pingand the/create-primarysuccess message render as embeds with separate fields.hearbeattypo in/pingoutput.No command schema changes, so
ApplicationCommandBulkOverwritewon't churn registrations.Test plan
go vet ./...go test -race ./...go build ./.../pingshows an ephemeral embed with theCommand delayandGateway heartbeatfields/helpshows an ephemeral embed listing commands, template fields, and examples/create-primary default-name:foo template:{{.Bogus}}reports the underlying template error rather than a generic message/create-primarywithoutManage Channelsstill reports the permission error/create-primaryshows the embed withdefault-nameandtemplatefields and creates the channelhttps://claude.ai/code/session_016tkC9bxfpYhFtrVQFp2vZa
Generated by Claude Code