Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Compeltely refactor protect and automod #1095

Open
wants to merge 34 commits into
base: main
Choose a base branch
from
Open

Conversation

ajax146
Copy link
Contributor

@ajax146 ajax146 commented Jul 22, 2024

This is a complete rewrite and restructure of protect and everything related to it.

protect.py was split into:
commands/moderator.py
commands/purge.py
core/moderation.py
functions/automod.py
functions/paste.py

Two additional files were added:
commands/modlog.py
commands/report.py

commands/moderator.py:
Moved all moderator actions into slash commands
Adds a new /unwarn command allowing individual warnings to be removed
Logs and displays who warned people (Fixes #657)
Mute can now have both a duration and a reason (fixes #721)

commands/modlog.py
Completely new feature, copying carlbots /modlog highscores and ban/unban logging
This additionally adds the ability to lookup bans by user or moderator
Bans are now forever stored in TS database (Fixes #380)

commands/purge.py
Moves purge command to /purge
Combines the duration and exact command

core/moderation.py
This handles the core actions of ban/unban/kick/mute/unmute/warn/unwarn and a few core logic items, like getting all warnings

functions/automod.py
Completely rewrites automod (Fixes #463)
Fixes regex not working (no issue for this one)
Adds a mute feature for automod (Fixes #1020)
Adds automod as a framework instead of a strict class, allowing other modules to run messages through automod
Adds IRC checks to automod (Fixes #212)

functions/paste.py
Paste now makes sure that the linx API request worked and that the message was sent BEFORE deleting the original message (Fixes #1077)
Paste checks if message violates automod, and if it was recommended that it was deleted, nothing happens

Other:
Who now shows new warning information (Fixes #180)
Moves duck to use the new core/moderation.py feature

@ajax146 ajax146 marked this pull request as ready for review July 25, 2024 00:58
@ajax146
Copy link
Contributor Author

ajax146 commented Jul 25, 2024

@TheKrol Come review this

@ajax146 ajax146 requested a review from TheKrol July 25, 2024 00:59
@ajax146 ajax146 changed the title Protect the second Compeltely refactor protect and automod Jul 25, 2024
@TheKrol
Copy link
Contributor

TheKrol commented Jul 30, 2024

Here is the list so far of things to I have found wrong:

  1. Warning by the bot, make sure it is displayed by the bot
  2. Report will fail if user has not avatar url
  3. Modmail highscore will fail if user left the server on list.
  4. Add the limit of purge to the error message
  5. Purge log has a target which is not needed
  6. Automod can warn people who are above them in role rank

Copy link
Contributor

@TheKrol TheKrol left a comment

Choose a reason for hiding this comment

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

More things to fix:

  1. Edge case, too many warning/notes will over load whois and warnings all
  2. Don't know if it is possible, but make report mention the user if you link a message of theirs?
  3. IRC automod worked for only Delete = True silent and warn = false, but it printed nothing in the chat, only in logs. Therefore, none of the other messages worked because nothing is printed in the main chat from IRC only logs

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