feat(command): add version command and Discord application integration - #473
Merged
Conversation
Closed
Contributor
There was a problem hiding this comment.
🟡 Changes recommended
There are a couple of concrete correctness/behavior issues (banner ignoring check_enabled, redundant command registration) that should be fixed before merge.
Once you've addressed the issues Copilot identified, you can request another Copilot review.
Pull request overview
This PR adds an update-checking subsystem to Rustmail and exposes version/update status through both Discord commands and the web panel, backed by new config and API surfaces.
Changes:
- Introduces an
[updates]config section (types + parsing/validation), persists update check metadata, and starts a background update checker on bot ready. - Adds “version” surfaces: Discord text + slash/user commands, and a
/api/bot/versionendpoint returning current/latest/update metadata. - Adds a web-panel update banner plus panel/wizard UI and i18n strings to configure and display update status.
File summaries
| File | Description |
|---|---|
| docs/reference/configuration.md | Documents new [updates] config section and behavior. |
| docs/guides/commands.md | Documents the new version command across surfaces. |
| crates/rustmail/src/setup/handlers/save.rs | Adds setup wizard support for enabling update checks. |
| crates/rustmail/src/modules/update_checker.rs | Implements periodic GitHub release polling + announcement + metadata storage. |
| crates/rustmail/src/modules/mod.rs | Exposes update_checker module and re-exports. |
| crates/rustmail/src/main.rs | Reuses shared CURRENT_VERSION constant. |
| crates/rustmail/src/i18n/language/fr.rs | Adds FR strings for version command and update announcement. |
| crates/rustmail/src/i18n/language/en.rs | Adds EN strings for version command and update announcement. |
| crates/rustmail/src/handlers/ready_handler.rs | Starts update checker when bot becomes ready (guarded). |
| crates/rustmail/src/handlers/guild_messages_handler.rs | Registers !version / !v text command. |
| crates/rustmail/src/config.rs | Adds updates to runtime config + validation + tests. |
| crates/rustmail/src/commands/version/text_command/version.rs | Implements !version / !v handler. |
| crates/rustmail/src/commands/version/text_command/mod.rs | Wires text-command module exports. |
| crates/rustmail/src/commands/version/slash_command/version.rs | Implements /version + user context command registration/handler. |
| crates/rustmail/src/commands/version/slash_command/mod.rs | Wires slash-command module exports. |
| crates/rustmail/src/commands/version/mod.rs | Adds version command module root. |
| crates/rustmail/src/commands/version/common.rs | Shared content builder for version output. |
| crates/rustmail/src/commands/mod.rs | Exposes version commands from the commands module. |
| crates/rustmail/src/commands/edit/common.rs | Updates test config construction to include updates. |
| crates/rustmail/src/bot.rs | Registers VersionCommand in command registry. |
| crates/rustmail/src/api/routes/bot.rs | Adds /api/bot/version route. |
| crates/rustmail/src/api/handler/bot/version.rs | Adds version/status API handler reading metadata from DB. |
| crates/rustmail/src/api/handler/bot/mod.rs | Exposes new version handler module. |
| crates/rustmail/src/api/handler/bot/config.rs | Extends config API to include updates. |
| crates/rustmail_types/src/config/updates.rs | Defines UpdateConfig type and defaults. |
| crates/rustmail_types/src/config/mod.rs | Exports UpdateConfig. |
| crates/rustmail_types/src/api/mod.rs | Extends ConfigResponse and adds VersionInfo. |
| crates/rustmail_panel/src/pages/panel.rs | Mounts the update banner in the panel layout. |
| crates/rustmail_panel/src/i18n/fr/fr.json | Adds FR panel strings for updates section/banner + wizard toggle. |
| crates/rustmail_panel/src/i18n/en/en.json | Adds EN panel strings for updates section/banner + wizard toggle. |
| crates/rustmail_panel/src/components/wizard/types.rs | Adds check_updates field to wizard state. |
| crates/rustmail_panel/src/components/wizard/step6_review.rs | Sends check_updates to setup save endpoint. |
| crates/rustmail_panel/src/components/wizard/step5_language.rs | Adds wizard UI toggle for update checks. |
| crates/rustmail_panel/src/components/update_banner.rs | Implements update-available banner fetching /api/bot/version. |
| crates/rustmail_panel/src/components/mod.rs | Exposes update_banner component module. |
| crates/rustmail_panel/src/components/configuration.rs | Adds “Updates” accordion section and form controls. |
| config.example.toml | Adds example [updates] section. |
Review details
- Files reviewed: 37/37 changed files
- Comments generated: 3
- Review effort level: Lite
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Comment on lines
+30
to
+41
| let latest = get_system_metadata("latest_known_version", &pool) | ||
| .await | ||
| .ok() | ||
| .flatten(); | ||
| let release_url = get_system_metadata("latest_release_url", &pool) | ||
| .await | ||
| .ok() | ||
| .flatten(); | ||
| let last_checked = get_system_metadata("last_update_check", &pool) | ||
| .await | ||
| .ok() | ||
| .flatten(); |
Contributor
There was a problem hiding this comment.
Fixed in 371be47: metadata keys are now centralized via shared constants from update_checker and reused in this handler.
Co-authored-by: Akinator31 <99099121+Akinator31@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This pull request introduces a new update-checking feature and a user-facing version command to Rustmail, along with related configuration options and API endpoints. It also includes internationalization support for these features and ensures robust configuration handling and testing.
Update Checking Feature:
[updates]section to the config file, allowing configuration of update checks (enabled, check interval, and notification channel).Version Command and API:
/versionAPI endpoint that returns current and latest version info, update availability, and related metadata (crates/rustmail/src/api/handler/bot/version.rs, [1] [2].!version/!v) and slash command for checking the running Rustmail version, with appropriate registration and handlers.Internationalization:
Config and API Integration:
updatessection, ensuring it is loaded, saved, and updated correctly.Testing and Robustness:
[updates]section.These changes collectively add a robust update-checking mechanism and a user-accessible version command, with full config, API, and internationalization support.