Update [p]economyset slottime&paydaytime to use TimedeltaConverter and not accept negative integers #4807
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!4807
Loading…
Reference in a new issue
No description provided.
Delete branch "patch-9"
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
Paydaytime and Slottime command seconds param now only takes a positive integer, but accepts 0
Paydaytime and Slottime seconds param has a converter so
1dwould be 86400 seconds, along with seconds, minutes, etc.There's already a timedelta converter you can make use of rather than making a new one
but that returns something like 0:00:50 right
Take a look at how slow mode if I remember takes use of it. You can convert a timedelta to seconds
oh its a timedelta object? alr
Thanks for making the fix, I have a few review comments that will need to be addressed before this can be approved and merged.
@ -11,6 +11,7 @@ import discordfrom redbot.cogs.bank import is_owner_if_bank_globalNow that you removed
TimeConverter, these imports are no longer used and can be removed.You removed a line in here and added whitespace to the other line which makes this PR fail the style check. You need to ensure that there are two empty lines between the class definitions. Or you can run Black to reformat this for you as explained in our contributing guidelines
@ -910,2 +913,3 @@Example:Examples:- `[p]economyset slottime 10`- `[p]economyset slottime 10m`The example above and the description of the
<seconds>parameter here should be updated to reflect the type of input that the used converter accepts.@ -926,1 +931,4 @@async def paydaytime(self, ctx: commands.Context, *, duration: TimedeltaConverter(default_unit="seconds")):"""Set the cooldown for the payday command.The example above and the description of the
<seconds>parameter here should be updated to reflect the type of input that the used converter accepts.@ -926,1 +931,4 @@async def paydaytime(self, ctx: commands.Context, *, duration: TimedeltaConverter(default_unit="seconds")):"""Set the cooldown for the payday command.finished
There are few more things that need to be changed before merging.
After you deal with the review comments for the docstrings, you should also update the
docs/cog_guides/economy.rstfile with the updated contents of docstrings.You're still failing style here. There should be exactly 2 lines between class definitions and there can be no characters in the line, and currently, you have trailing spaces in here.
@ -904,16 +905,21 @@ class Economy(commands.Cog):)Now that this accepts numbers with units, it would make more sense if this argument were named
duration(ortime,cooldown, whatever you think makes sense here).Remember to also update the docstring with the new name and update this code:
to be this instead (or whatever name you choose for argument):
It probably makes sense to set default unit to seconds here:
This isn't really clear to the user, I would suggest sth like this:
Now that this accepts numbers with units, it would make more sense if this argument were named
duration(ortime,cooldown, whatever you think makes sense here).Remember to also update the docstring with the new name and update this code:
to be this instead (or whatever name you choose for argument):
It probably makes sense to set default unit to seconds here:
This isn't really clear to the user, I would suggest sth like this:
I'm assuming you'll be working on it in full later (or are working on it now), can you send a comment in here once you finish, @Andeeeee? It would make it easier for me to know when this is ready to be reviewed again :)
k done
Looks good to me, thanks for contributing.