Skip to content

Feat/add spamprocessor and list command#6

Draft
not-meet wants to merge 3 commits into
RocketChat:feature/spam-detection-corefrom
not-meet:feat/add-spamprocessor-and-list-command
Draft

Feat/add spamprocessor and list command#6
not-meet wants to merge 3 commits into
RocketChat:feature/spam-detection-corefrom
not-meet:feat/add-spamprocessor-and-list-command

Conversation

@not-meet
Copy link
Copy Markdown
Collaborator

No description provided.

Copy link
Copy Markdown

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

Adds a first end-to-end spam monitoring pipeline to the Rocket.Chat app: message analysis for new users, persistence of per-user “spam level” state, and an admin-facing /spammonitor list command to view flagged users.

Changes:

  • Introduces SpamProcessor + MessageCache to analyze messages for multiple spam “gates” (duplicates, cross-channel spread, rate flood, URL spam, etc.).
  • Adds persistence for user spam status (UserStatusStore) and a handler/command layer to expose /spammonitor list.
  • Wires the app into the Rocket.Chat IPostMessageSent hook and updates UI-kit/icon dependencies.

Reviewed changes

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

Show a summary per file
File Description
AppsSpamMonitorApp.ts Initializes cache/processor, registers slash command, and hooks message processing into IPostMessageSent.
app.json Declares the IPostMessageSent implementation.
src/core/spamProcessor.ts Core message analysis + escalation triggers.
src/core/cache/messageCache.ts In-memory per-user message history + rate tracking.
src/persistence/userStatusStore.ts Persists and escalates per-user spam status records.
src/handlers/handler.ts Formats and sends slash command responses (list/help/permission).
src/commands/commandUtilities.ts Defines /spammonitor slash command and dispatches subcommands.
src/definition/spamlevel.ts Defines spam levels, labels, escalation thresholds, and cooldown durations.
src/definition/spamProcessor.ts Defines the analysis result contract.
src/definition/messageCache.ts Defines the cached message shape used by the cache.
src/enums/notifications.ts Adds user-facing help and notification strings.
src/enums/commandUtilities.ts Adds list subcommand enum.
package.json Updates Rocket.Chat UI-kit/icon dependency versions.
package-lock.json Lockfile updates for dependency version bumps.

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

Comment on lines +38 to +42
const roles = sender.roles || [];
if (!roles.includes('admin')) {
await handler.sendHelp();
return;
}
await handler.listFlaggedUsers();
break;
default:
await handler.sendNoPermission();
Comment thread src/core/spamProcessor.ts
Comment on lines +32 to +44
public updateConfig(
monitoringWindowMs: number,
slidingWindowMs: number,
crossChannelThreshold: number,
rateShortBurst: number,
rateSustained: number,
): void {
(this as any).monitoringWindowMs = monitoringWindowMs;
(this as any).slidingWindowMs = slidingWindowMs;
(this as any).crossChannelThreshold = crossChannelThreshold;
(this as any).rateShortBurst = rateShortBurst;
(this as any).rateSustained = rateSustained;
}
Comment thread AppsSpamMonitorApp.ts
Comment on lines +63 to +65
http: IHttp,
persistence: IPersistence,
modify: IModify,
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.

2 participants