feat(aurora): migrated to Red's builtin timedelta/relativedelta parsing
All checks were successful
Actions / Lint Code (Ruff & Pylint) (push) Successful in 26s
Actions / Build Documentation (MkDocs) (push) Successful in 20s

This commit is contained in:
SeaswimmerTheFsh 2024-03-08 14:19:48 -05:00
parent 6035aea5c6
commit f4efcb8ea5
Signed by: cswimr
GPG key ID: B8953EC01E5C4063
5 changed files with 50 additions and 62 deletions

View file

@ -1,8 +1,10 @@
# pylint: disable=cyclic-import
import json
from datetime import datetime
from datetime import timedelta as td
from typing import Union
from dateutil.relativedelta import relativedelta as rd
from discord import Guild, Interaction, Member, SelectOption, User
from discord.errors import Forbidden, NotFound
from redbot.core import commands
@ -283,3 +285,9 @@ def create_pagesize_options() -> list[SelectOption]:
)
)
return options
def timedelta_from_relativedelta(relativedelta: rd) -> td:
"""Converts a relativedelta object to a timedelta object."""
now = datetime.now()
then = now - relativedelta
return now - then