Allow mute commands to update duration of the mute #4992
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
2 participants
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
Mrcoolgamer11/Red-DiscordBot!4992
Loading…
Reference in a new issue
No description provided.
Delete branch "davidhu99/V3/develop"
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
Previously, when the author wanted to mute an already muted user, if muted user already inside muted list (if statement on line 1666), "That user is already muted in this channel." would be sent to the text channel and the user's current mute duration would not get updated.
Currently, when author mutes an already muted user, there will be an update to the mute duration. One case we accounted for is if the author changes the mute duration and happens to hit it after the mute task has been created. In this case, there may be an extra unmute task in the self.unmute_tasks cache, which will do nothing. We accounted for this by checking if an unmute task is in the unmute_tasks cache, and cancelling it if there is.
Closes #4834
Is it correct to allow the mute command to shorten the duration of the mute too?
Good point, in my opinion it should not. However, in the original issue the author said to "update" which would be both shorten and lengthen. Let me know whether to only shorten!
@bobloy Yes the mute command should allow shortening the duration of a mute as well as extending it, it is the moderators perogative to choose when to mute until and maybe they want to lessen the time to unmute.
Something that wasn't really discussed but should be addressed for consistency is the mute function should also check if there is an existing server unmute task when a user is server muted and cancel the task the same way you did for channel mutes.
I believe I did that with my if condition on line 1668. Let me know if that's not the correct way to do it
You handled it for channel mutes but role-based server mutes still suffer from the same issue.
I see, please check out my last commit for the solution to that :)
@ -1532,6 +1532,14 @@ class Mutes(VoiceMutes, commands.Cog, metaclass=CompositeMetaClass):if guild.id not in self._server_mutes:This file has logging setup. So if you really want to keep this here I recommend changing to
log.debugrather than print or remove this entirely. It might be worth considering doing alog.info(f"{user} has had their mute time updated in {guild}")but I don't think that's entirely necessary.@ -1532,6 +1532,14 @@ class Mutes(VoiceMutes, commands.Cog, metaclass=CompositeMetaClass):if guild.id not in self._server_mutes:Oh sorry that was just a sanity check for me, I'll delete it.
This PR was ported to the current codebase in
28c1a1c79instead of being merged as-is:Allow updating the duration of existing mutes. Pending automatic unmutes are
cancelled and, for channel mutes, the cached original permission overwrites
are kept instead of being replaced with the already-muted overwrites.