[Mutes] Duration should take the first value provided #6274
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 milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
Mrcoolgamer11/Red-DiscordBot#6274
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
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?
What Red version are you using?
3.5.5
Cog name
Mutes
Command name
mute
What did you expect to happen?
[p]mute <user_id> 1h spamming 3 copypastas within 2 hours.The first time mentioned is
1h, which means the intended mute time is 1 hour.What actually happened?
Our example:
[p]mute <user_id> 1h spamming 3 copypastas within 2 hours.If you mention a time, even after one has been specified, it will use the last time mentioned. In this case,
2 hoursis used as the duration instead of the intended1h.Per
muteshelp screen, the following examples are provided:I would argue that the first mention of a time should be used as the base for the command's duration. In a
reasonyou might need to explain that a certain amount of bad behavior took place within a time duration.For further explanation, the
mutehelp provides this:[p]mute <users...> [time_and_reason]Being picky,
timeis listed beforereason. Therefore, the line of thinking is that you provide a time before the reason, even if it does not matter when reviewing listed examples.How can we reproduce this error?
mutescog.mutecommand as such:[p]mute <user_id> 1h spamming 3 copypastas within 2 hours2 hoursinstead of the1hspecified first.Anything else?
This would not effect the ability to format mutes in the second example, except it would reverse the behavior (second time is now overwritten by first time mentioned).
[p]mute @member1 @member2 spam 5 hoursIf no other time is passed before the
5 hoursin the command, this would function just the same. Mostly this bug report is looking to change the behavior to accept the first mention of a time, rather than the last as it would make more sense.It's expected behavior that the time can be matched anywhere in the string, however it might not be expected behavior to use the last time in the string. Currently, it loops over all the matches front to back, and overrides the assumed time with each valid match, meaning the last time entered will be chosen. It might make sense to
breakon valid match, to ensure the first time entered is the one that is used.github.com/Cog-Creators/Red-DiscordBot@3fd0afd87d/redbot/cogs/mutes/converters.py (L50-L54)Additionally, it seems like the regex may be overly ambitious in matching the single letter versions of times in some cases, such as
5 warningsbeing interpreted as5 w.Repro: