Skip to content

fix(commands): route slash commands to GeekBot instead of Rocket.cat#42

Open
sunba91-su wants to merge 1 commit into
mainfrom
fix/slash-command-routing
Open

fix(commands): route slash commands to GeekBot instead of Rocket.cat#42
sunba91-su wants to merge 1 commit into
mainfrom
fix/slash-command-routing

Conversation

@sunba91-su

Copy link
Copy Markdown
Owner

Summary

Fixes #41 — slash commands starting with /standup were intercepted by Rocket.Chat server (unknown command) and responded to by Rocket.cat instead of GeekBot.

Root Cause

Rocket.Chat processes messages starting with / server-side. Unregistered commands are rejected with "Invalid command" and never delivered to the room — GeekBots DDP subscription never receives the message.

Changes

1. internal/rocket/client.go — RegisterSlashCommand()

Calls POST /api/v1/commands.register with {"command": "standup", "clientOnly": true}. This tells the server the command is valid — the message is delivered to the room for GeekBot to pick up via its existing DDP subscription.

2. internal/commands/registry.go — Support !standup prefix

Dispatch() now accepts both /standup and !standup prefixes. This is the fallback — if commands.register fails (insufficient permissions, old server), users can type !standup help and it works immediately.

3. cmd/bot/main.go — Register at startup

Attempts registration on connect. Non-fatal on failure — logs a warning and continues.

4. internal/commands/help.go — Updated help text

Mentions both /standup and !standup prefixes.

Verification

  • go build ./... — passes
  • go test -race ./... — passes
  • go vet ./... — passes

Do not merge — waiting for user review.

Register /standup as a client-only slash command via POST commands.register
so Rocket.Chat delivers the message to the room instead of intercepting it.
Add !standup prefix as a fallback for environments where registration is
unavailable (e.g., insufficient permissions).

Closes #41
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.

bug: slash commands not routed to GeekBot — Rocket.cat intercepts /standup

1 participant