Skip to content

Use new RelativedeltaConverter/parse_relativedelta in core cogs #5244

@Jackenmen

Description

@Jackenmen

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]tempban itself 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, uses parse_relativedelta on 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 #5000 (review)

Metadata

Metadata

Assignees

No one assigned

    Labels

    Category: Cogs - ModThis is related to the Mod cog.Category: Cogs - MutesThis is related to the Mutes cog.Status: AcceptedWe want thisStatus: PRs WelcomeNo one is currently assigned to this issue, but we'd be grateful if anyone made a PR.Type: EnhancementSomething meant to enhance existing Red features.

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions