Summary
受 OpenClaw Discord Workflow blog 文章啟發,為 OpenAB 新增進階 thread 管理功能,提升多人使用時的 Discord 體驗。
Current State vs Proposed
| Feature |
Current |
Proposed |
| Thread creation |
Only on @mention |
Optional "direct mode" — auto-thread on any message |
| Thread naming |
Truncate to 40 chars + GitHub URL shortening |
Optional LLM-generated short titles |
| Auto-archive |
Hardcoded OneDay |
Configurable per-channel (60m, 1d, 3d, 1w) |
| Per-channel config |
None |
Independent settings per channel |
| Ignore other mentions |
None |
Skip when other bots are mentioned |
Proposed Features
1. Configurable Auto-Archive Duration
- Current: Hardcoded
AutoArchiveDuration::OneDay (discord.rs:366)
- Goal: Add
auto_archive_duration to config.toml
- Support Discord API's four options: 60, 1440, 4320, 10080 minutes
- Global default with per-channel override
- Validate at config load time (not at Discord API call time)
2. LLM-Generated Thread Names
- Current:
shorten_thread_name() truncates to 40 chars (discord.rs:338-348)
- Goal: Add
thread_name_mode setting: "truncate" (current) or "generated"
- In
"generated" mode, use a lightweight API call (not ACP session) to generate a short title (≤100 chars, Discord limit)
- Implementation: Standalone API call, not through ACP session pool (avoids lock contention since thread doesn't exist yet at naming time)
- Fallback to truncate mode on failure, 3s timeout
- Note: 40-char limit is a design choice, not a Discord constraint — consider relaxing
3. Direct Mode (Auto-Thread without Mention)
- Current: Must @mention bot in main channel to trigger
- Goal: Add
require_mention setting (per-channel)
false = "direct mode": any message auto-creates a thread
- Suitable for dedicated bot channels
- Considerations:
- Race condition: concurrent messages may trigger parallel thread creation — add per-channel debounce or mutex
- Bot loop prevention: in direct mode, other bots' messages would also trigger threads — should skip all bot messages
4. Ignore Other Mentions
- Goal: Add
ignore_other_mentions setting
- When a message mentions other bots/users but not this bot, don't respond
- Prevents false triggers in multi-bot environments
5. Per-Channel Configuration
- Goal: Allow independent settings per channel, overriding global defaults
[discord]
bot_token = "${DISCORD_BOT_TOKEN}"
allowed_channels = ["111111", "222222"]
auto_archive_duration = 1440
thread_name_mode = "truncate"
require_mention = true
ignore_other_mentions = false
[discord.channels."111111"]
auto_archive_duration = 60
require_mention = false
[discord.channels."222222"]
thread_name_mode = "generated"
auto_archive_duration = 10080
Files to Modify
src/config.rs — Channel-level config structs + validation
src/discord.rs — Thread creation logic, mention handling
config.toml.example — Updated example
charts/openab/templates/configmap.yaml — Helm template for per-channel config
charts/openab/values.yaml — New values
README.md — Document Manage Threads permission requirement
Implementation Priority
- Configurable auto-archive duration (smallest change)
- Per-channel configuration (foundation for other features)
- Direct mode / require_mention (validates per-channel config)
- Ignore other mentions (builds on direct mode)
- LLM-generated thread names (most complex, requires standalone API integration)
References
Summary
受 OpenClaw Discord Workflow blog 文章啟發,為 OpenAB 新增進階 thread 管理功能,提升多人使用時的 Discord 體驗。
Current State vs Proposed
OneDayProposed Features
1. Configurable Auto-Archive Duration
AutoArchiveDuration::OneDay(discord.rs:366)auto_archive_durationtoconfig.toml2. LLM-Generated Thread Names
shorten_thread_name()truncates to 40 chars (discord.rs:338-348)thread_name_modesetting:"truncate"(current) or"generated""generated"mode, use a lightweight API call (not ACP session) to generate a short title (≤100 chars, Discord limit)3. Direct Mode (Auto-Thread without Mention)
require_mentionsetting (per-channel)false= "direct mode": any message auto-creates a thread4. Ignore Other Mentions
ignore_other_mentionssetting5. Per-Channel Configuration
Files to Modify
src/config.rs— Channel-level config structs + validationsrc/discord.rs— Thread creation logic, mention handlingconfig.toml.example— Updated examplecharts/openab/templates/configmap.yaml— Helm template for per-channel configcharts/openab/values.yaml— New valuesREADME.md— DocumentManage Threadspermission requirementImplementation Priority
References
src/discord.rs:350-371src/discord.rs:338-348