Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
70 changes: 69 additions & 1 deletion build/scripts/commands/general.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions build/scripts/config.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

70 changes: 69 additions & 1 deletion src/commands/general.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import { FishServer, Gamemode, rules, text } from "/config";
import { command, commandList, fail, formatArg, Perm, Req } from "/frameworks/commands";
import type { FishCommandData } from "/frameworks/commands/types";
import { Menu } from "/frameworks/menus";
import { capitalizeText, Duration, escapeTextDiscord, StringBuilder, StringIO, to2DArray } from "/funcs";
import { capitalizeText, Duration, escapeTextDiscord, StringBuilder, StringIO, to2DArray, setToArray } from "/funcs";
import { FishEvents, fishPlugin, fishState, ipPortPattern, recentWhispers, tileHistory, uuidPattern } from "/globals";
import { FMap } from "/maps";
import { FishPlayer } from "/players";
Expand Down Expand Up @@ -1133,5 +1133,73 @@ Win rate: ${target.stats.gamesWon / target.stats.gamesFinished}`
unit.add();
outputSuccess(f`Spawned a ${args.type} that is partly a ${args.base}.`);
}
},

report: {
args: [],
description: 'Report a player to staff with a selected reason.',
perm: Perm.play,
requirements: [Req.cooldown(4000)],
async handler({sender, outputSuccess, outputFail, f}) {
const onlinePlayers = setToArray(Groups.player);
if(onlinePlayers.length === 0){
outputFail('No players online to report.');
return;
}
Comment on lines +1144 to +1148
Copy link

Copilot AI Jan 12, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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);

Copilot uses AI. Check for mistakes.
const target = await Menu.menu<mindustryPlayer>(
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

'Report Player',
'Select a player to report.',
onlinePlayers,
sender,
{
includeCancel: true,
optionStringifier: player => player.name
}
).catch(() => {
outputFail('Report cancelled.');
return;
});
if(!target) return;
if(target === sender.player){
outputFail('You cannot report yourself.');
return;
}

const baseReasons = [
'Griefing',
'Harassment',
'Cheating / Exploiting',
'Spam',
'Trolling',
'Other',
];
const reasons = target.admin ? [...baseReasons, 'Admin Abuse'] : baseReasons;
const reason = await Menu.menu<string>(
'Report Reason',
`Select a reason for reporting [accent]${target.name}[]`,
reasons,
sender,
{ includeCancel: true }
).catch(() => {
outputFail('Report cancelled.');
return;
});
if(!reason) return;

const issuerName = sender.player?.name ?? 'Unknown';
const targetName = target.name;
const serverName = Gamemode.name();
const message =
`[Report] Server: ${serverName}\n` +
`Issuer: ${Strings.stripColors(issuerName)}\n` +
`Target: ${Strings.stripColors(targetName)}${target.admin ? ' (Admin)' : ''}\n` +
`Reason: ${reason}`;

api.sendStaffMessage(message, issuerName, (sent) => {
if(sent) outputSuccess(f`Report sent to staff: ${targetName} for "${reason}".`);
else outputFail('Failed to send report to staff. Please try again later.');
});
},
}

});
1 change: 1 addition & 0 deletions src/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ export const bannedWords: {
"fanum tax", "gyatt", "rizz", "skibidi", //With love, DarthScion
//>:( -dart
"uwu", //lol
// why?? why the uwu??? -starkatt

"nig"+"ger", "nig"+"ga", "niger", "ni8"+"8er", "nig"+"gre", //our apologies to citizens of the Republic of Niger
"негр", "ниггер",
Expand Down