Skip to content

[feat]: Add pre-message send prevention and restrictions manager#12

Open
not-meet wants to merge 1 commit into
RocketChat:mainfrom
not-meet:feat/implement-restrictions-manager
Open

[feat]: Add pre-message send prevention and restrictions manager#12
not-meet wants to merge 1 commit into
RocketChat:mainfrom
not-meet:feat/implement-restrictions-manager

Conversation

@not-meet
Copy link
Copy Markdown
Collaborator

@not-meet not-meet commented Jun 5, 2026

Summary

Previously, when a user was flagged as a spammer, the system silently stored their spam level in persistence with zero user-facing feedback. Flagged users had no idea they were being monitored or restricted, and could continue sending messages even after being placed on cooldown or suspended.
This PR adds two things:

  • Message blocking via IPreMessageSentPrevent restricted users are now actually blocked from sending messages
  • User-facing DM notifications flagged users receive a direct message explaining what happened and how long the restriction lasts

Changes Made

  • added checkPreMessageSentPrevent,executePreMessageSentPrevent, checkPostMessageSent in
    AppsSpamMonitorApp.ts - to gate messages from restricted users before they are sent.

  • restrictionsManager.ts - handles DMing the flagged user and applying the action based on their spamming level

  • en.ts - single source of truth for all runtime notification message strings, keyed by SpammingLevel as typed functions so duration is injected dynamically

  • messageUtils.ts - formatDuration (converts ms to human-readable string) and buildMessage

  • userStatusStore.ts - added method to fetch if user is restricted or not


DEMO

  • spammers POV of getting pinged by bot when reached a spamming level
Screencast.from.2026-06-06.02-18-55.webm
  • messages does not hit rc channel when the spammer is on timeout
Screenshot from 2026-06-06 02-19-55

Closes #9

@not-meet not-meet requested a review from alfredodelfabro June 5, 2026 23:08
@not-meet not-meet added the enhancement New feature or request label Jun 5, 2026
@not-meet not-meet self-assigned this Jun 5, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[feat] : notify spammer on detection and apply timeout with duration message

1 participant