Skip to content

Run slash commands from mentions - #10

Merged
anott03 merged 1 commit into
mainfrom
amitav/at-commands
Aug 24, 2026
Merged

Run slash commands from mentions#10
anott03 merged 1 commit into
mainfrom
amitav/at-commands

Conversation

@anott03

@anott03 anott03 commented Aug 24, 2026

Copy link
Copy Markdown
Contributor

Summary

@-ing the bot now behaves as a slash command when the first word after the mention matches a registered command name, falling back to the AI agent otherwise.

  • @lynn ping (also @lynn /ping) → runs the /ping command, replies "Pong!"
  • @lynn what is a duck? → no matching command, so the question goes to the agent

Changes

  • src/discord/types.ts — decouple Command.execute from APIInteraction by introducing CommandContext (channelId?, userId?, args) and CommandResult (content, ephemeral?), so the gateway and interactions handler share one contract.
  • src/discord/commands/ping.ts — updated to the new execute signature.
  • src/discord/interactions.ts — maps the interaction to a CommandContext and wraps the result in a ChannelMessageWithSource response. Slash command behavior unchanged.
  • src/discord/gateway.tsparseMentionCommand matches the first token (optional leading /, case-insensitive) against registered commands; on a match it runs the command and posts the reply via the channel API, otherwise falls through to the existing flagship-gated agent path.
  • README.md — documents mention-dispatch behavior.

Behavior notes

  • Mention-invoked commands bypass the lynn-ai-agent feature flag; only the agent fallback is gated.
  • Remaining text after the command name is passed as args (available to commands, currently unused by ping).

Verification

  • pnpm exec tsc --noEmit passes
  • pnpm lint (oxlint) passes

View with [code]smith Autofix with [code]smith
Need help on this PR? Tag @codesmith-bot with what you need. Autofix is disabled.

@-ing the bot now behaves as a slash command when the first word
matches a registered command (e.g. `@lynn ping`), falling back to
the AI agent otherwise. Commands bypass the lynn-ai-agent flag.

Decouples Command.execute from APIInteraction by introducing
CommandContext/CommandResult, so the gateway and the interactions
handler share one command contract.
@github-actions

Copy link
Copy Markdown

Preview Deployed

URL: https://dbaa77a3-lynn-lynn-pr-10-lme3gt3xx5pglzfy.amitavnott.workers.dev

Built from commit a9f63cf


This comment updates automatically with each push.

@anott03
anott03 merged commit 9fe889a into main Aug 24, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant