Cog-Creators / Red-DiscordBot

A multi-function Discord bot
https://docs.discord.red
GNU General Public License v3.0
4.63k stars 2.28k forks source link

Improve timedelta conversions #6349

Closed Zephyrkul closed 3 months ago

Zephyrkul commented 3 months ago

Description of the changes

Resolves #6274

Have the changes in this PR been tested?

Yes

Zephyrkul commented 3 months ago

Regex101 link if you want to test the regex easily.

Zephyrkul commented 3 months ago

Minor something worth noting, I've intentionally created an edgematch variation to re.search to only match the timedelta at the beginning or end of the string as per the original intent of the code. That said, the new modified regex should make it possible to simply re.search the string to reflect current behavior, while still fixing all the bugs mentioned in #6274. If whoever reviews would prefer the latter approach, let me know.