Skip to content

rewrite: moderation module improvements #1335

@kyranet

Description

@kyranet

The current version, v8, was thought to be really good, it introduced a centralized system and made both moderation commands and moderation monitors a lot easier to make.

However, just adding a new moderation type required us to modify 5 files on different places (and more if they supported timers), and in several cases, we were even forced to duplicate a lot of code and even add metadata in many places just so they're supported.

For v9, I'd like to have an abstract ModerationAction (and TimedModerationClass) class in which all types would inherit. The benefit in this is that all metadata for each action, as well as their specific handlers and comparisons, are in the exact same file. What does this accomplish? Adding a new moderation action implies creating a new file and modifying the manager to register it.

Furthermore, I would like to separate the action type and the metadata in two different fields.

In v8, we used bit masks to optimize disk size on the DB, as we were using RethinkDB. However, PostgreSQL can optimize space a lot better as it's not stored as JSON. The current system has locked the system to 15 different actions (Ban, Kick, Mute, Prune, Softban, VoiceKick, VoiceMute, Warning, RestrictedReaction, RestrictedEmbed, RestrictedAttachment, RestrictedVoice, SetNickname, AddRole, RemoveRole, and RestrictedEmoji). If we want to add a new action, we simply can't without modifying the entire system. I suspect we'll eventually run into this (custom moderation actions?), so I want Skyra to be prepared ahead of time.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions