MODiX icon indicating copy to clipboard operation
MODiX copied to clipboard

Moderation Behavior Refactoring

Open JakenVeina opened this issue 5 years ago • 2 comments

This ended up being a bit of a rat's nest of intertwined dependencies, so much so that I had to diagram it to get my head around it. So I figured I should let my proposed refactorings be reviewed first, before I implement anything.

ModerationAutoConfig Refactoring - Before.pdf

ModerationAutoConfig Refactoring - After.pdf

JakenVeina avatar May 30 '20 02:05 JakenVeina

I think that makes sense, the mentioning setup shouldn't have been a moderation function. Might have to do some testing of the various scenarios to make sure nothing blows up. (E.g., what if someone deletes the mute role and then creates a new channel - does it make sure the mute role actually exists before trying to update the channel permissions, stuff like that)

Scott-Caldwell avatar May 30 '20 16:05 Scott-Caldwell

I renamed GetOrCreateMuteRoleAsync() because I wasn't feeling it, but I would have that behavior be the same. I would have MuteRoleId be a cached value, per-guild, and attempt to retrieve it from the ISocketGuild on each call. If it's missing, then we go through the process of re-creating it.

Although, actually, now that I think about it, that scenario would still be problematic, because we wouldn't rebuild the permissions for the new role until the next GuildAvailableNotification. Perhaps we should actually handle RoleDeletedNotification? Or, I can just throw an exception in GetOrCreateMuteRoleAsync() if someone's stupid enough to do this.

JakenVeina avatar May 30 '20 17:05 JakenVeina

As part of a new effort to refocus on priorities, I will close this. If you feel this is imperative to the bot, a new issue can be opened to supersede this.

patrickklaeren avatar Mar 26 '24 14:03 patrickklaeren