-
Notifications
You must be signed in to change notification settings - Fork 0
[v9] ヘルプコマンドの実装 #228
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: feat/go
Are you sure you want to change the base?
[v9] ヘルプコマンドの実装 #228
Conversation
yuito-it
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
と言いたいのですが...一点だけ。
jsonで処理するのは型の観点から好ましくないと考えており、constでファイルに定義していただけるとありがたいです。
|
helpディレクトリにgit addしてなかったのでしばしお待ちを... |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR implements a help command for the Discord bot that displays information about available commands. The implementation allows users to view all commands or get detailed information about a specific command.
Changes:
- Added
/helpcommand with optional parameter to view specific command details - Created JSON data file containing help information for all bot commands
- Registered the help command in the command registry and handler map
- Fixed a formatting issue in docker-compose.prod.yaml (unrelated cleanup)
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 9 comments.
Show a summary per file
| File | Description |
|---|---|
| src/internal/bot/command/registry.go | Registers the new help command handler |
| src/internal/bot/command/general/help/commands.json | Contains help text and usage information for all commands |
| src/internal/bot/command/general/help.go | Implements the help command handler with JSON loading and embed generation |
| src/internal/bot/command/commands.go | Adds help command to the application command list |
| _docker-compose.prod.yaml | Fixes formatting issue (extra dash removed) |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
|
||
| // 特定のコマンドが指定された場合 | ||
| if specificCommand != "" { | ||
| title = "Help - " + specificCommand + " コマンド" |
Copilot
AI
Jan 28, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The "Skip" choice references "/skip" as a standalone command, but skip is actually a subcommand of tts (accessible via /tts skip). This mismatch will cause the help lookup to fail when users select this option, as there is no matching entry with the name "/skip" at the expected level in commands.json.
| title = "Help - " + specificCommand + " コマンド" | |
| Value: "/tts skip", |
|
|
||
| // Usage が設定されている場合は表示 | ||
| if cmd.Usage != "" { | ||
| fields = append(fields, &discordgo.MessageEmbedField{ |
Copilot
AI
Jan 28, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Potential nil pointer dereference. When i.Member is nil (which can happen in DM contexts), the code falls back to i.User. However, later in the code (lines 151-157), it directly accesses user.Username and user.AvatarURL(""). If i.Member is nil in guild contexts (which shouldn't happen but could in edge cases), this would work but be inconsistent. The established pattern in the codebase is to assume i.Member is always available and use i.Member.DisplayName() and i.Member.AvatarURL("") directly without null checks. See src/internal/bot/command/general/about.go:59 and src/internal/bot/command/general/ping.go:34-40 for consistent patterns.
| Description: "利用可能なコマンドの一覧を表示します", | ||
| Options: []*discordgo.ApplicationCommandOption{ |
Copilot
AI
Jan 28, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The Title and Description fields in the helpCommandData struct are never used or populated by the commands.json file. The JSON file only contains a "fields" array, but these struct fields expect top-level "title" and "description" properties that don't exist in the JSON. These unused fields should either be removed from the struct or the JSON should be updated to include them.
| Description: "利用可能なコマンドの一覧を表示します", | |
| Options: []*discordgo.ApplicationCommandOption{ | |
| Title string `json:"-"` | |
| Description string `json:"-"` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.
help追加
#215