feat(discord): add /remind slash command#797
Conversation
Implements a /remind slash command that lets humans schedule delayed mentions to users/roles in the channel. - Command: /remind <targets> <message> <delay> - Delay range: 1m to 30d (supports m/h/d and combinations) - Only humans can invoke (bots rejected) - Persistence: reminders.json survives restarts - Re-schedules pending reminders on bot ready Closes #796
|
All PRs must reference a prior Discord discussion to ensure community alignment before implementation. Please edit the PR description to include a link like: This PR will be automatically closed in 3 days if the link is not added. |
This comment has been minimized.
This comment has been minimized.
… input validation - Cargo.toml: add serde feature to chrono (fixes E0277 CI failure) - remind.rs: release mutex before sync file I/O to avoid blocking executor - remind.rs: replace unwrap_or_default() with explicit error log on serialization failure - remind.rs: fix test_parse_delay_too_short (remove wrong assertion that bare "30" errors) - discord.rs: add 1800-char cap on reminder message - discord.rs: neutralize @everyone/@here in message via zero-width space
…emoval - F4: Per-user rate limit (max 5 active reminders) - F7: create_dir_all before writing reminders.json - F8: Deduplicate reminder scheduling on reconnect via scheduled_ids - F9: Only remove reminder from store after successful send
b65cfbc to
aa1bf41
Compare
|
LGTM ✅ — All findings addressed, CI green. What This PR DoesAdds a How It Works
Findings
What's Good (🟢)
Reviewers: 普渡法師 ✅, 擺渡法師 ✅, 覺渡法師 ✅ | Aggregated by 超渡法師 |
…dation - parse_delay: empty, invalid unit, case-insensitive, whitespace, boundaries - format_delay: zero, pure units - ReminderStore: add/remove/pending, persistence across reload - sanitize_message: @everyone/@here neutralization - validate_message: length cap enforcement - Extract sanitize_message/validate_message as testable helpers
- Add MAX_TARGETS = 10 constant - Reject /remind with >10 mentions (suggest using @ROLE) - Update docs/slash-commands.md with constraint - Add test for constant
…licate on reconnect
Summary
Adds a
/remindslash command that lets humans schedule one-shot delayed mentions to users/roles in the channel.Closes #796
What Changed
src/remind.rs— New module:Reminderstruct,ReminderStore(JSON persistence), delay parser, schedulersrc/discord.rs— Register/remindcommand with 3 string options (targets, message, delay); handler validates input, persists, and schedules via tokio; re-schedules pending reminders onreadysrc/main.rs— Wire upReminderStoreand pass to DiscordHandlerdocs/slash-commands.md— Document the new commandUsage
Fires after 2 hours:
Design Decisions
Mentionabletype only allows one mention per option; using a string lets users specify multiple@user @rolementions$HOME/.openab/reminders.jsoncmd.user.botcheck prevents bot-to-bot reminder loopsTesting
parse_delay) and formatter (format_delay)Not Included (future work)
/remind list//remind cancelsubcommands