Repository navigation
feat(bot): implement role create and delete audit log handlers - #388
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
Caution Review failedPull request was closed or merged during review 📝 WalkthroughWalkthroughThis PR adds test coverage and implementation for Discord audit event handlers for role creation and deletion. A refactored shared helper function Changes
Sequence DiagramsequenceDiagram
participant Discord as Discord.js Events
participant Handler as auditHandler
participant Toggle as featureToggleService
participant Guild as Guild
participant AuditLog as auditLogService
participant ServerLog as serverLogService
Discord->>Handler: GuildRoleCreate / GuildRoleDelete event
Handler->>Toggle: isEnabled('SERVER_LOGS')
Toggle-->>Handler: enabled/disabled
alt Feature Enabled
Handler->>Guild: fetchAuditLogs(auditLogAction)
Guild-->>Handler: audit log entry or undefined
Handler->>ServerLog: createLog(role, action, moderatorId?)
ServerLog-->>Handler: success / error
else Feature Disabled
Handler->>Handler: skip logging
end
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes 🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
|





Summary
GuildRoleCreateandGuildRoleDeleteaudit log handlersisServerLogsEnabled) to both role handlershandleAuditEventsChanges
auditHandler.ts: Added event registration forEvents.GuildRoleCreateandEvents.GuildRoleDeleteauditHandler.ts: Added feature toggle checks tohandleRoleCreateandhandleRoleDeleteauditHandler.spec.ts: Added 8 tests for role events + 2 error wrapper testsTest Results
All 34 tests passing in
auditHandler.spec.tsRelated
Closes the TODO comment at lines 383-385 in
auditHandler.tsSummary by CodeRabbit
Bug Fixes
Tests