-
Notifications
You must be signed in to change notification settings - Fork 16
temp mute non suspecious players when they use n word #166
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: master
Are you sure you want to change the base?
Conversation
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 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.
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>
|
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 |
you can configure the duration of mute in Milliseconds in
well idk, i did what the issue wanted |
|
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. |
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(); |
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.
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; |
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.
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"); |
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.
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.
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.
requires #95
Co-authored-by: BalaM314 <71201189+BalaM314@users.noreply.github.com>
|
so, things to do?
|
|
For now you can do a permanent mute, timed mute should be a separate PR |
for issue #69
implemented a temp mute system for non-suspicious players : players get temp mute if they use n word in chat.