Skip to content

Refactor ModerationService.cs to use IInfractionTypeHandler#1047

Open
NullEntity2 wants to merge 1 commit intodiscord-csharp:mainfrom
NullEntity2:moderation-refactor-2
Open

Refactor ModerationService.cs to use IInfractionTypeHandler#1047
NullEntity2 wants to merge 1 commit intodiscord-csharp:mainfrom
NullEntity2:moderation-refactor-2

Conversation

@NullEntity2
Copy link
Copy Markdown

@NullEntity2 NullEntity2 commented Dec 16, 2025

This change extracts the InfractionType logic into distinct classes to define their behavior. Mute, Notice, Warning, Ban each get their own class. This prevents the need to switch on types in multiple places within ModerationService. Importantly this will help with an addition I'm planning of a new InfractionType.

This CR was AI powered, but manually reviewed.

Copy link
Copy Markdown
Contributor

@ChaseDRedmon ChaseDRedmon left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@NullEntity2 NullEntity2 marked this pull request as draft December 16, 2025 03:01
@NullEntity2 NullEntity2 force-pushed the moderation-refactor-2 branch from 82b52f8 to 921065a Compare December 16, 2025 04:07
@NullEntity2 NullEntity2 marked this pull request as ready for review December 16, 2025 04:08
@NullEntity2
Copy link
Copy Markdown
Author

I wasn't registering the types in DI - I thought it was automatic. I updated the commit to do that manually.

Copy link
Copy Markdown
Contributor

@Jay-Madden Jay-Madden left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

:shipit:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants