Use new RelativedeltaConverter/parse_relativedelta in core cogs #5244
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#5244
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 component of Red (cog, command, API) would you like to see improvements on?
Mod, Mutes
Describe the enhancement you're suggesting.
After looking through existing commands, the commands that could benefit from this are
[p]tempban(and by extension, also[p]modset defaultduration) and the mute commands in Mutes cog. Both of these however are not just a simple find&replace.Change to
[p]tempbanitself is simple, however we should also support setting a relativedelta as the default duration in[p]modset defaultduration. I suppose that the easiest acceptable way of doing it would be to have a custom converter that accepts a string, usesparse_relativedeltaon it, and returns the original string which we can then save to Config. There would also be a need for a config migration that would convert the existing values (integers) to the new format. An alternative solution for storing would be to use a serialized relativedelta - dictionary with the proper kwargs for relativedelta.As for mute commands, the above applies but the regex for Mutes's cogs custom MuteTime converter is a bit different to allow time interval both at the beginning and the end of the mute reason. I'm guessing that we will just use relativedelta here directly rather than the converter.
Anything else?
Originally posted by @jack1142 in https://github.com/Cog-Creators/Red-DiscordBot/pull/5000#pullrequestreview-746704199
Der zugehörige PR #5402 wurde geschlossen (die API-Form war nicht final). Die Mutes- und Mod-Cogs funktionieren mit den bestehenden timedelta-Convertern. Eine Umstellung auf relativedelta brächte vor allem Monate und Jahre als Einheit, rechtfertigt aber keine neue öffentliche API. Deshalb schließe ich das Issue.
Generated by Claude Code