Skip to content

Conversation

@sciwhiz12
Copy link
Collaborator

@sciwhiz12 sciwhiz12 commented Feb 18, 2023

This PR switches our moderation event listeners from the various gateway events to the new audit log entry creation event.

Our previous system meant that we would have to manually query the audit log to retrieve the editor/moderator who performed the action, which is cumbersome and prone to timing issues (whether the gateway event is fired first or the audit log is updated first, and whether there are other audit log entries before the relevant one).


Tasks needed to be done before merge:

  • Switch to the new event in RoleEvents
    • This requires testing to discover what exactly the audit log change contains for roles being added or removed.
    • Additionally, what does the audit log entry look like with integration (Server Boosting) or linked roles?
  • Yeet Utils#getAuditLog
  • Reduce code duplication of embeds in ModerationEvents
    • There should at least be a method which prepopulates a builder which handles the common features (footer, timestamp, possibly the color as well).
    • Not today.
  • Test the new functionality
    • Test by fire.

This lessens our dependence on Utils#getAuditLog, which is prone to
timing issues (whether the audit log is updated or the gateway event is
sent first).
@Matyrobbrt
Copy link
Collaborator

Please use retrieveUser/MemberById with a possible ErrorHandler instead of getUser/MemberById.

@sciwhiz12 sciwhiz12 marked this pull request as ready for review February 24, 2023 14:39
@sciwhiz12 sciwhiz12 requested a review from Matyrobbrt February 24, 2023 14:39
@Matyrobbrt Matyrobbrt merged commit f785fd6 into 4.0 Feb 25, 2023
@sciwhiz12 sciwhiz12 deleted the audit-log-create-event branch February 25, 2023 14:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants