-
-
Notifications
You must be signed in to change notification settings - Fork 2.3k
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
[Mod] Enhanced [p]hackban #2164
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Black went on its own way and said that our int's aren't good enough.
redbot/cogs/mod/mod.py
Outdated
@@ -39,7 +68,7 @@ class Mod: | |||
|
|||
def __init__(self, bot: Red): | |||
self.bot = bot | |||
self.settings = Config.get_conf(self, 4961522000, force_registration=True) | |||
self.settings = Config.get_conf(self, 4_961_522_000, force_registration=True) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Black went a bit nuts here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it does that for readability but it's not really useful for us in this case. I guess we have to tweak it a bit.
redbot/cogs/mod/mod.py
Outdated
special_date = datetime(2016, 1, 10, 6, 8, 4, 443000) | ||
is_special = user.id == 96130341705637888 and guild.id == 133049272517001216 | ||
special_date = datetime(2016, 1, 10, 6, 8, 4, 443_000) | ||
is_special = user.id == 96_130_341_705_637_888 and guild.id == 133_049_272_517_001_216 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
And here too.
redbot/cogs/mod/mod.py
Outdated
if user is not None: | ||
# Instead of replicating all that handling... gets attr from decorator | ||
try: | ||
await ctx.invoke(self.ban, user, days, reason=reason) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Edge case still to be fixed here: at the moment if the invoked ban fails, the banning is still successful as far as the hackban command is concerned.
I think I covered all the edge cases after the last commit. Should be ready to be tested fully. |
Gonna give it a shot. |
If you hackban someone and the mod-log channel is not set to a channel, you get this error:
I'm not sure if this is the case on brand new installs, this was on a bot that had a mod-log channel set and then removed and when that removal occurs the mod-log channel saved in the settings.json is set as "null" for that guild. |
@aikaterna Is this related to what this PR introduces? I'm doing the same call (and error handling) as the other commands so if this is a separate problem it might be worth opening a dedicated issue |
I put the whole |
I'd like to take a look at this later, but I'm in favor of anything that de-duplicates shared logic, and moves as much out of command objects as is sane to do (increases ability for things written to be used by other things sanely). |
Type
Description of the changes
This PR makes use of the recently introduced Greedy and Optional to enhance the
[p]hackban
command, allowing multiple user IDs to be passed. It also adds the optional "message deletion days" parameter.Work in progress and not completely tested yet (especially the modlog's case creation)
Feedback welcome