Commit 2cb3de7
committed
feat(bot): implement report and cancel commands for user moderation
- Add `ReportCommand` class:
- Introduced functionality for users to report messages to group admins.
- Reports are sent only to admins without publicly tagging them, maintaining privacy.
- `report` method:
- Allows users to report a message by replying to it.
- Gathers reported user details, message link, and notifier information.
- Collects admin mentions and prepares a formatted notification message.
- Sends a confirmation message to the reporter about the report being queued.
- Adds a 5-minute delay before sending the report to admins, allowing time for cancellation.
- Stores pending reports in `pendingReports` using user IDs as keys and timeout IDs as values.
- `cancel` method:
- Enables reporters to cancel their pending reports.
- Checks if a report is queued for the user and clears the associated timeout.
- Notifies the user if their report was successfully canceled or if no pending report exists.
- Enhancements:
- Improved user experience with detailed notifications.
- Ensured admins receive concise and well-formatted reports with clickable links to reported messages.
- Prevents spamming admins with immediate reports by introducing a delay mechanism.
- Pending Reports:
- Maintains a map of pending reports to manage and track active report requests.
- Supports cleanup by removing processed or canceled reports.
- Future Improvements:
- Extend moderation tools for admins, such as automated actions based on reports.
- Add analytics or tracking for repeated offenses.1 parent f0d1a87 commit 2cb3de7
1 file changed
Lines changed: 80 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
0 commit comments