Add support for timeouts to Mutes cog #5604
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!5604
Loading…
Reference in a new issue
No description provided.
Delete branch "mutes-add-timeouts"
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?
Description of the changes
Add timeouts support to the Mutes cog. This changes the default server mute behavior to utilize timeouts while maintaining role mutes if they have been previously setup. This adds a new
[p]timeoutcommand that exclusively uses discords built in timeout feature. This also allows the[p]activemutescommand to list the currently muted and timed out users in the server. This also adds some models that make it easier for managing typed responses for internal muting methods.Have the changes in this PR been tested?
Yes
Could we make it so that you can choose wether to use timeouts or mutes by using like
[p]muteset usetimeouts, and having the command stay[p]mute, instead of having it be[p]timeout?I think we should have a
[p]timeoutcommand, but a setting could redirect[p]muteto[p]timeoutif server's admins prefer this option to a real role.Yeah that's a good idea!
Various developer-facing documentation should be updated to reflect an accurate description of the behavior under timeouts rather than channel override based mutes (lines 101, 315, 771).
I have not yet run the code, these are the issues I found from simply reviewing it.
It seems like this is no longer used, so it should probably be removed from here and the defaults.
@ -1157,17 +1091,16 @@ class Mutes(VoiceMutes, commands.Cog, metaclass=CompositeMetaClass):else:user_str = user.mentionif mutes["until"]:If this PR is entirely replacing channel override mutes with timeout mutes, the docstring for this command and the output of
[p]muteset force_role_mutesneeds to be update to reflect that.This appears to be appending a failing response twice. I believe the above check is because the failure message for moving users is successful with a reason, however it will also append an issue in cases where there was not a success, since they to have a reason set. They would then be appended again by this line.
This isn't strictly an error with your PR, but there is no reason to be translating the strings both here and in the definition of
MUTE_UNMUTE_ISSUES. This applies to this whole function,unmute_user,channel_mute_user, andchannel_unmute_user.Same issue with potentially double appending as before.
@BlizzardTheWolf @AAA3A-AAA3A, the PR currently replaces the backup behavior for
[p]mutewhen a mute role is not configured to use timeouts, rather than channel overrides. The[p]timeoutcommand also exists for explicitly timing out a user, regardless of whether or not[p]muteis configured to use a role.Actually this is necessary since the call to translate the string does not actually happen until here with the correct context. The initialized variables can be argued for not needing it and I can't remember the exact reason for why we left it this way and I can't find the discussion on it now. I just tested the change and can confirm that removing the translation
_()from any of these cause the result to not correctly translate the message._()calls in globals are so that redgettext can collect these strings but they're just passthrough and don't do anything (nor should they since the translations need to happen in a context where the locale is properly set)._()calls in actual code are so that the strings actually get translated but those won't be collected by redgettext since they don't operate on string literals.This, and the previous mention of a similar situation, are both intended. There are two lists we're dealing with here one for successful mutes we can largely ignore and another for ones with potential problems.
The only situation where we have successfully muted the user but still have a reason is when the user is currently in a voice channel and the bot was unable to move the user in the voice channel triggering discord to actually mute them. Therefore it should be notified to the command issuer that we were able to mute them but they may still be speaking in the voice channel and further action may need to be taken.
I missed the if/else block...
I don't think this makes it use timeouts, it just allows timeouts to be used at all. I'm not sure if this setting is even needed, now that there's no API spam to need to opt in to.
Nitpick but
[p]unmute/[p]channelunmutesetsaudit_reasongenerated fromreasonand passes that tochannel_unmute_user()instead:@ -1409,3 +1426,3 @@await ctx.send(msg.format(users=humanize_list([f"{u}" for u in success_list]), time=time)msg.format(users=humanize_list([f"`{u}`" for u in success_list]), time=time))@ -1547,3 +1641,3 @@users=humanize_list([f"{u}" for u in success_list])users=humanize_list([f"`{u}`" for u in success_list])))