Skip to content

Conversation

@starkatt85
Copy link

for issue #69

implemented a temp mute system for non-suspicious players : players get temp mute if they use n word in chat.

Copilot AI review requested due to automatic review settings January 13, 2026 13:38
Copy link

Copilot AI left a 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 pull request implements a temporary mute system for non-suspicious players who use the n-word in chat, addressing issue #69. Players with fewer than 3 joins are considered suspicious and already get permanently stopped/muted for using banned words; this PR adds a 10-minute temporary mute for established players who use the n-word.

Changes:

  • Added configurable temp mute duration (10 minutes) in config.ts
  • Implemented n-word detection and temp-mute logic in processChat function for non-suspicious players
  • Updated build files with transpiled JavaScript

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 5 comments.

File Description
src/config.ts Adds tempMute configuration object with configurable duration for n-word violations
src/utils.ts Implements temp mute logic with n-word pattern matching and automated unmute timer
build/scripts/config.js Transpiled JavaScript for config changes
build/scripts/utils.js Transpiled JavaScript for utils changes

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

starkatt85 and others added 4 commits January 13, 2026 19:22
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
copilot's suggestion upon automatic review

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
@spentcud
Copy link
Contributor

10min mute feels a bit too forgiving considering that (last i checked 💀) most staff agree that saying the nword is a ban on the spot

@starkatt85
Copy link
Author

10min mute feels a bit too forgiving considering

you can configure the duration of mute in Milliseconds in config.ts file

that (last i checked 💀) most staff agree that saying the nword is a ban on the spot

well idk, i did what the issue wanted

@spentcud
Copy link
Contributor

not sure how to change the duration meself honestly-

@starkatt85
Copy link
Author

not sure how to change the duration meself honestly-

the value must be changed by code. You can discuss about this feature if you want this to remain or not and come up with a duration of mute, then it can be hardcored into the code.

starkatt85 and others added 2 commits January 14, 2026 16:34
Co-authored-by: BalaM314 <71201189+BalaM314@users.noreply.github.com>

if (!suspicious) {
// for - https://github.com/Fish-Community/fish-commands/issues/69
const normalized = removeFoosChars(message).toLowerCase();
Copy link
Member

Choose a reason for hiding this comment

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

This also needs to remove color tags, or it would allow things like bad[white]word.

Maybe this (strip colors, remove foos chars, lowercase) should be made into a function? something like cleanTextLight

if (nwordPattern.test(normalized)) {
const durationMs = tempMute.nwordDurationMs;
const muteTimestamp = Date.now();
(fishPlayer as any)._lastAutomodMuteAt = muteTimestamp;
Copy link
Member

Choose a reason for hiding this comment

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

Don't use undeclared fields like this, it's bad practice. Remove the underscore and add it to the type definition for FishPlayer with the other transients, like autoflagged.

Log.info(`[automod] Temp-muted ${player.name} (${player.uuid()}) for ${Math.round(durationMs / 60000)}m: n-word`);
Timer.schedule(() => {
if ((fishPlayer as any)._lastAutomodMuteAt === muteTimestamp) {
void fishPlayer.unmute("automod");
Copy link
Member

@BalaM314 BalaM314 Jan 14, 2026

Choose a reason for hiding this comment

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

This won't work if the server restarts between the mute and unmute: void fishPlayer.mute("automod") syncs the mute to the backend, so the player will be muted indefinitely, but will not get unmuted.

You can fix this by storing the scheduled unmute, but that will get complicated. (What if the server doesn't come back online? What if the server crashes while saving and needs a rollback?) It's usually better design to avoid updating stored state on a timer, because it causes bugs like this. Instead, we need to change the stored muted property to be a timestamp like unmarkTime.

Copy link
Member

Choose a reason for hiding this comment

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

requires #95

starkatt85 and others added 2 commits January 14, 2026 17:55
Co-authored-by: BalaM314 <71201189+BalaM314@users.noreply.github.com>
@starkatt85
Copy link
Author

so, things to do?

  1. a cleanTextLight function that cleans everything from the test and gives exactly what a player would "see"
  2. autoFlagged property for FishPlayer
  3. "when to unmute, if temp muted" should be stored and have the player unmuted accordingly and not depend on "schedule" (which gets forgotten without doing what it needs to do at the end of the timer if server restarts)

@BalaM314
Copy link
Member

For now you can do a permanent mute, timed mute should be a separate PR

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants