[Mod] Enhanced [p]hackban #2164
No reviewers
Labels
No labels
Automated PR
Blocked
Blocked By: Damage Control
Blocked By: Dependency
Blocked By: Other PR
Breaking Change
Category: CI
Category: Cogs - Admin
Category: Cogs - Alias
Category: Cogs - Audio
Category: Cogs - Bank
Category: Cogs - Cleanup
Category: Cogs - CustomCommands
Category: Cogs - Dev
Category: Cogs - Downloader
Category: Cogs - Economy
Category: Cogs - Filter
Category: Cogs - General
Category: Cogs - Image
Category: Cogs - Mod
Category: Cogs - Modlog
Category: Cogs - Mutes
Category: Cogs - Permissions
Category: Cogs - Reports
Category: Cogs - Streams
Category: Cogs - Trivia
Category: Cogs - Trivia - Lists
Category: Cogs - Warnings
Category: Core - API - App Commands Package
Category: Core - API - Audio
Category: Core - API - Bank
Category: Core - API - Commands Package
Category: Core - API - Config
Category: Core - API - Other
Category: Core - API - Utils Package
Category: Core - Bot Class
Category: Core - Bot Commands
Category: Core - Command-line Interfaces
Category: Core - Downloader
Category: Core - Help
Category: Core - i18n
Category: Core - Modlog
Category: Core - Other Internals
Category: Core - RPC/ZMQ
Category: Docker
Category: Docs - Changelogs
Category: Docs - For Developers
Category: Docs - Install Guides
Category: Docs - Other
Category: Docs - User Guides
Category: Meta
Category: RPC/ZMQ methods
Category: Vendored Packages
Changelog Entry: Added
Changelog Entry: Pending
Changelog Entry: Skipped
Closed: Duplicate
Closed: External
Closed: Invalid
Closed: User Error
Closed: Won't Fix
Complex Issue
Docs-only
Feature Branch
Good First Issue
Help Wanted
High Priority
Needs Backport To stable-docs
No Activity
No Repro
QA: Bypassed
QA: Changes Requested
QA: Passed
Release Blocker
Status: Accepted
Status: Frozen
Status: In Progress
Status: Needs Discussion
Status: Needs Info
Status: Needs Triage
Status: PRs Welcome
Type: Bug
Type: Dependency Update
Type: Deprecation
Type: Enhancement
Type: Feature
Type: Informational
Type: Merge
Type: Optimisation
Type: Question
Type: Removal
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
Mrcoolgamer11/Red-DiscordBot!2164
Loading…
Reference in a new issue
No description provided.
Delete branch "V3/greedy_mod"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Type
Description of the changes
This PR makes use of the recently introduced Greedy and Optional to enhance the
[p]hackbancommand, 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
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.
@ -473,0 +445,4 @@text += "\n".join(errors.values())for p in pagify(text):await ctx.send(p)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
[p]banlogic into its own function, so that it can be used by both commands. This was necessary to handle the[p]baninvocation from[p]hackbancleanly: before, if any error occurred, it would send a separate message for it. So, for example, if 9 bans out of 10 failed, you would get the[p]hackban's "results" message plus 9 separate messages coming from[p]ban.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).