Conversation
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
There was a problem hiding this comment.
Pull request overview
This PR adds a new /report command that allows players to report other players to staff with selectable reasons.
Changes:
- Added a new
reportcommand with interactive menu-based player and reason selection - Added
setToArrayto imports in general.ts to support converting player groups to arrays - Added a humorous comment in config.ts
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| src/config.ts | Added a humorous comment questioning the "uwu" banned word |
| src/commands/general.ts | Implemented the new report command with menu-based player and reason selection, integrated with the staff messaging API |
| build/scripts/config.js | Compiled JavaScript version of the config.ts comment change |
| build/scripts/commands/general.js | Compiled JavaScript version of the new report command |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| const onlinePlayers = setToArray(Groups.player); | ||
| if(onlinePlayers.length === 0){ | ||
| outputFail('No players online to report.'); | ||
| return; | ||
| } |
There was a problem hiding this comment.
The check for no players online does not account for the case where the sender is the only player online. In this scenario, the menu will be shown with only the sender as an option, and the error "You cannot report yourself" will only be displayed after the user selects themselves. Consider filtering out the sender from onlinePlayers before checking the length, or checking if there are any other players besides the sender. For example: const onlinePlayers = setToArray(Groups.player).filter(p => p !== sender.player);
| outputFail('No players online to report.'); | ||
| return; | ||
| } | ||
| const target = await Menu.menu<mindustryPlayer>( |
There was a problem hiding this comment.
You've written custom logic to select a player with a menu. The commands framework handles this automatically: specify args: ["player:player"] and it will do this without any extra code.
as requested