Skip to content

feat(discord): add writer management commands#309

Merged
viettranx merged 3 commits intomainfrom
feat/discord-writer-commands
Mar 20, 2026
Merged

feat(discord): add writer management commands#309
viettranx merged 3 commits intomainfrom
feat/discord-writer-commands

Conversation

@mrgoonie
Copy link
Contributor

Summary

  • Port Telegram's /addwriter, /removewriter, /writers commands to Discord (!addwriter, !removewriter, !writers)
  • Inject agentStore + configPermStore into Discord channel struct, DRY factory code
  • Fix system prompt injection (buildGroupWriterPrompt) to also query guild-wide wildcard scope for Discord guilds

Design

  • Guild-wide wildcard scope guild:{guildID}:* — matches any per-user context via matchWildcard()
  • !removewriter revokes both guild-wide and auto-bootstrapped per-user permissions
  • Commands accept both ! and / prefixes
  • Target user resolved from reply-to message or @mention

Test plan

  • !addwriter @user in Discord guild → adds user as file writer
  • !removewriter @user → removes user (blocks if last writer)
  • !writers → lists current guild writers
  • Commands rejected in DMs
  • Only existing writers can manage the list
  • Non-writer blocked from file writes at tool level
  • System prompt shows correct writer restrictions for Discord guild users
  • go build ./... and go vet ./... pass clean

mrgoonie and others added 3 commits March 20, 2026 17:11
…ter, !writers)

Port Telegram's file writer commands to Discord with guild-wide scope.
Uses wildcard scope (guild:{guildID}:*) to match per-user contexts.
Also fixes system prompt injection to find guild-wide writers.
CheckPermission with guild-wide wildcard scope (guild:{guildID}:*)
fails to match auto-bootstrapped per-user perms. Use per-user scope
(guild:{guildID}:user:{senderID}) which matches both per-user exact
and guild-wide wildcard stored patterns via matchWildcard.
…meout

- Deduplicate writers by UserID after merging guild-wide and per-user
  scope results in buildGroupWriterPrompt to prevent duplicates when a
  user has both grant types.
- Add 10s context timeout to Discord writer command handlers instead of
  using context.Background() to prevent DB calls from hanging.
@viettranx viettranx merged commit 7040081 into main Mar 20, 2026
2 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.

2 participants