Feat/add spamprocessor and list command#6
Draft
not-meet wants to merge 3 commits into
Draft
Conversation
There was a problem hiding this comment.
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+MessageCacheto 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
IPostMessageSenthook 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 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 on lines
+63
to
+65
| http: IHttp, | ||
| persistence: IPersistence, | ||
| modify: IModify, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.