WIP: Moderation type registry #26

Closed
cswimr wants to merge 146 commits from aurora-3rd-party into main
3 changed files with 10 additions and 7 deletions
Showing only changes of commit dc51aa7bdc - Show all commits

View file

@ -4,9 +4,9 @@ from typing import Literal, Optional
from redbot.core.bot import Red from redbot.core.bot import Red
from ..models.base import AuroraBaseModel
from ..models.partials import PartialUser
from ..utilities.logger import logger from ..utilities.logger import logger
from .base import AuroraBaseModel
from .partials import PartialUser
class Change(AuroraBaseModel): class Change(AuroraBaseModel):

View file

@ -8,11 +8,11 @@ import discord
from discord import NotFound from discord import NotFound
from redbot.core.bot import Red from redbot.core.bot import Red
from ..models.base import AuroraGuildModel
from ..models.change import Change
from ..models.partials import PartialChannel, PartialRole, PartialUser
from ..utilities.logger import logger from ..utilities.logger import logger
from ..utilities.utils import get_next_case_number from ..utilities.utils import get_next_case_number
from .base import AuroraGuildModel
from .change import Change
from .partials import PartialChannel, PartialRole, PartialUser
class Moderation(AuroraGuildModel): class Moderation(AuroraGuildModel):
@ -241,7 +241,10 @@ class Moderation(AuroraGuildModel):
elif not isinstance(timestamp, datetime): elif not isinstance(timestamp, datetime):
timestamp = datetime.fromtimestamp(timestamp) timestamp = datetime.fromtimestamp(timestamp)
if duration != "NULL" and duration is not None: if duration == "NULL":
duration = None
if duration is not None:
end_timestamp = timestamp + duration end_timestamp = timestamp + duration
else: else:
duration = None duration = None

View file

@ -1,7 +1,7 @@
from discord import Forbidden, HTTPException, InvalidData, NotFound from discord import Forbidden, HTTPException, InvalidData, NotFound
from redbot.core.bot import Red from redbot.core.bot import Red
from ..models.base import AuroraBaseModel, AuroraGuildModel from .base import AuroraBaseModel, AuroraGuildModel
class PartialUser(AuroraBaseModel): class PartialUser(AuroraBaseModel):