From d91a4f49f9bc36d4d751012f6e6a91ede2912a73 Mon Sep 17 00:00:00 2001 From: SeaswimmerTheFsh Date: Mon, 6 May 2024 21:39:43 -0400 Subject: [PATCH] fix(aurora): fixed import errors --- aurora/aurora.py | 38 ++++++++++++++++----------------- aurora/importers/aurora.py | 4 ++-- aurora/importers/galacticbot.py | 4 ++-- aurora/menus/addrole.py | 4 ++-- aurora/menus/guild.py | 6 +++--- aurora/menus/immune.py | 4 ++-- aurora/menus/overrides.py | 6 +++--- aurora/models/change.py | 6 +++--- aurora/models/moderation.py | 10 ++++----- aurora/models/partials.py | 2 +- aurora/utilities/database.py | 2 +- aurora/utilities/factory.py | 16 ++++++-------- aurora/utilities/json.py | 2 +- aurora/utilities/utils.py | 12 +++++------ 14 files changed, 55 insertions(+), 61 deletions(-) diff --git a/aurora/aurora.py b/aurora/aurora.py index fe9abcb..01655a9 100644 --- a/aurora/aurora.py +++ b/aurora/aurora.py @@ -23,26 +23,24 @@ from redbot.core.commands.converter import parse_relativedelta, parse_timedelta from redbot.core.utils.chat_formatting import (box, error, humanize_list, humanize_timedelta, warning) -from aurora.importers.aurora import ImportAuroraView -from aurora.importers.galacticbot import ImportGalacticBotView -from aurora.menus.addrole import Addrole -from aurora.menus.guild import Guild -from aurora.menus.immune import Immune -from aurora.menus.overrides import Overrides -from aurora.models.change import Change -from aurora.models.moderation import Moderation -from aurora.utilities.config import config, register_config -from aurora.utilities.database import connect, create_guild_table -from aurora.utilities.factory import (addrole_embed, case_factory, - changes_factory, evidenceformat_factory, - guild_embed, immune_embed, - message_factory, overrides_embed) - -from aurora.utilities.json import dump -from aurora.utilities.logger import logger -from aurora.utilities.utils import (check_moddable, check_permissions, - get_footer_image, log, send_evidenceformat, - timedelta_from_relativedelta) +from .importers.aurora import ImportAuroraView +from .importers.galacticbot import ImportGalacticBotView +from .menus.addrole import Addrole +from .menus.guild import Guild +from .menus.immune import Immune +from .menus.overrides import Overrides +from .models.change import Change +from .models.moderation import Moderation +from .utilities.config import config, register_config +from .utilities.database import connect, create_guild_table +from .utilities.factory import (addrole_embed, case_factory, changes_factory, + evidenceformat_factory, guild_embed, + immune_embed, message_factory, overrides_embed) +from .utilities.json import dump +from .utilities.logger import logger +from .utilities.utils import (check_moddable, check_permissions, + get_footer_image, log, send_evidenceformat, + timedelta_from_relativedelta) class Aurora(commands.Cog): diff --git a/aurora/importers/aurora.py b/aurora/importers/aurora.py index 7d1b273..e9622a4 100644 --- a/aurora/importers/aurora.py +++ b/aurora/importers/aurora.py @@ -8,8 +8,8 @@ from discord import ButtonStyle, Interaction, Message, ui from redbot.core import commands from redbot.core.utils.chat_formatting import box, warning -from aurora.models.moderation import Moderation -from aurora.utilities.database import connect, create_guild_table +from ..models.moderation import Moderation +from ..utilities.database import connect, create_guild_table class ImportAuroraView(ui.View): diff --git a/aurora/importers/galacticbot.py b/aurora/importers/galacticbot.py index 50d51b9..a7c2d27 100644 --- a/aurora/importers/galacticbot.py +++ b/aurora/importers/galacticbot.py @@ -7,8 +7,8 @@ from discord import ButtonStyle, Interaction, Message, ui from redbot.core import commands from redbot.core.utils.chat_formatting import box, warning -from aurora.models.moderation import Change, Moderation -from aurora.utilities.database import connect, create_guild_table +from ..models.moderation import Change, Moderation +from ..utilities.database import connect, create_guild_table class ImportGalacticBotView(ui.View): diff --git a/aurora/menus/addrole.py b/aurora/menus/addrole.py index 9f4d1ff..36c9056 100644 --- a/aurora/menus/addrole.py +++ b/aurora/menus/addrole.py @@ -2,8 +2,8 @@ from discord import ButtonStyle, Interaction, Message, ui from redbot.core import commands from redbot.core.utils.chat_formatting import error -from aurora.utilities.config import config -from aurora.utilities.factory import addrole_embed +from ..utilities.config import config +from ..utilities.factory import addrole_embed class Addrole(ui.View): diff --git a/aurora/menus/guild.py b/aurora/menus/guild.py index ece8131..71186b7 100644 --- a/aurora/menus/guild.py +++ b/aurora/menus/guild.py @@ -1,9 +1,9 @@ from discord import ButtonStyle, Interaction, Message, ui from redbot.core import commands -from aurora.utilities.config import config -from aurora.utilities.factory import guild_embed -from aurora.utilities.utils import create_pagesize_options +from ..utilities.config import config +from ..utilities.factory import guild_embed +from ..utilities.utils import create_pagesize_options class Guild(ui.View): diff --git a/aurora/menus/immune.py b/aurora/menus/immune.py index 7d85d12..dd710b1 100644 --- a/aurora/menus/immune.py +++ b/aurora/menus/immune.py @@ -2,8 +2,8 @@ from discord import ButtonStyle, Interaction, Message, ui from redbot.core import commands from redbot.core.utils.chat_formatting import error -from aurora.utilities.config import config -from aurora.utilities.factory import immune_embed +from ..utilities.config import config +from ..utilities.factory import immune_embed class Immune(ui.View): diff --git a/aurora/menus/overrides.py b/aurora/menus/overrides.py index beefaef..4327131 100644 --- a/aurora/menus/overrides.py +++ b/aurora/menus/overrides.py @@ -1,9 +1,9 @@ from discord import ButtonStyle, Interaction, Message, ui from redbot.core import commands -from aurora.utilities.config import config -from aurora.utilities.factory import overrides_embed -from aurora.utilities.utils import create_pagesize_options +from ..utilities.config import config +from ..utilities.factory import overrides_embed +from ..utilities.utils import create_pagesize_options class Overrides(ui.View): diff --git a/aurora/models/change.py b/aurora/models/change.py index ceb4641..029f76b 100644 --- a/aurora/models/change.py +++ b/aurora/models/change.py @@ -4,9 +4,9 @@ from typing import Literal, Optional from redbot.core.bot import Red -from aurora.models.base import AuroraBaseModel -from aurora.models.partials import PartialUser -from aurora.utilities.logger import logger +from ..models.base import AuroraBaseModel +from ..models.partials import PartialUser +from ..utilities.logger import logger class Change(AuroraBaseModel): diff --git a/aurora/models/moderation.py b/aurora/models/moderation.py index 11678b6..d63df3e 100644 --- a/aurora/models/moderation.py +++ b/aurora/models/moderation.py @@ -8,11 +8,11 @@ import discord from discord import NotFound from redbot.core.bot import Red -from aurora.models.base import AuroraGuildModel -from aurora.models.change import Change -from aurora.models.partials import PartialChannel, PartialRole, PartialUser -from aurora.utilities.logger import logger -from aurora.utilities.utils import get_next_case_number +from ..models.base import AuroraGuildModel +from ..models.change import Change +from ..models.partials import PartialChannel, PartialRole, PartialUser +from ..utilities.logger import logger +from ..utilities.utils import get_next_case_number class Moderation(AuroraGuildModel): diff --git a/aurora/models/partials.py b/aurora/models/partials.py index 48ff2a0..0402e88 100644 --- a/aurora/models/partials.py +++ b/aurora/models/partials.py @@ -1,7 +1,7 @@ from discord import Forbidden, HTTPException, InvalidData, NotFound from redbot.core.bot import Red -from aurora.models.base import AuroraBaseModel, AuroraGuildModel +from ..models.base import AuroraBaseModel, AuroraGuildModel class PartialUser(AuroraBaseModel): diff --git a/aurora/utilities/database.py b/aurora/utilities/database.py index 16f8a7e..588ad35 100644 --- a/aurora/utilities/database.py +++ b/aurora/utilities/database.py @@ -5,7 +5,7 @@ import sqlite3 from discord import Guild from redbot.core import data_manager -from aurora.utilities.logger import logger +from .logger import logger def connect() -> sqlite3.Connection: diff --git a/aurora/utilities/factory.py b/aurora/utilities/factory.py index e7886ff..e032a6e 100644 --- a/aurora/utilities/factory.py +++ b/aurora/utilities/factory.py @@ -2,18 +2,14 @@ from datetime import datetime, timedelta from typing import Union -from discord import (Color, Embed, Guild, Interaction, InteractionMessage, - Member, Role, User) +from discord import Color, Embed, Guild, Interaction, InteractionMessage, Member, Role, User from redbot.core import commands -from redbot.core.utils.chat_formatting import (bold, box, error, - humanize_timedelta, warning) - -from aurora.models.moderation import Moderation -from aurora.models.partials import PartialUser -from aurora.utilities.config import config -from aurora.utilities.utils import (get_bool_emoji, get_next_case_number, - get_pagesize_str) +from redbot.core.utils.chat_formatting import bold, box, error, humanize_timedelta, warning +from ..models.moderation import Moderation +from ..models.partials import PartialUser +from .config import config +from .utils import get_bool_emoji, get_next_case_number, get_pagesize_str async def message_factory( color: Color, diff --git a/aurora/utilities/json.py b/aurora/utilities/json.py index 73595ee..7a0cd15 100644 --- a/aurora/utilities/json.py +++ b/aurora/utilities/json.py @@ -3,7 +3,7 @@ from datetime import datetime, timedelta from redbot.core.bot import Red -from aurora.models.base import AuroraBaseModel +from ..models.base import AuroraBaseModel class JSONEncoder(json.JSONEncoder): diff --git a/aurora/utilities/utils.py b/aurora/utilities/utils.py index ff950b1..ed115de 100644 --- a/aurora/utilities/utils.py +++ b/aurora/utilities/utils.py @@ -8,7 +8,7 @@ from discord.errors import Forbidden from redbot.core import commands, data_manager from redbot.core.utils.chat_formatting import error -from aurora.utilities.config import config +from ..utilities.config import config def check_permissions( @@ -111,7 +111,7 @@ async def check_moddable( def get_next_case_number(guild_id: str, cursor=None) -> int: """This function returns the next case number from the MySQL table for a specific guild.""" - from aurora.utilities.database import connect + from .database import connect if not cursor: database = connect() @@ -125,8 +125,8 @@ def get_next_case_number(guild_id: str, cursor=None) -> int: async def log(interaction: Interaction, moderation_id: int, resolved: bool = False) -> None: """This function sends a message to the guild's configured logging channel when an infraction takes place.""" - from aurora.models.moderation import Moderation - from aurora.utilities.factory import log_factory + from ..models.moderation import Moderation + from .factory import log_factory logging_channel_id = await config.guild(interaction.guild).log_channel() if logging_channel_id != " ": @@ -147,8 +147,8 @@ async def log(interaction: Interaction, moderation_id: int, resolved: bool = Fal async def send_evidenceformat(interaction: Interaction, moderation_id: int) -> None: """This function sends an ephemeral message to the moderator who took the moderation action, with a pre-made codeblock for use in the mod-evidence channel.""" - from aurora.models.moderation import Moderation - from aurora.utilities.factory import evidenceformat_factory + from ..models.moderation import Moderation + from .factory import evidenceformat_factory send_evidence_bool = ( await config.user(interaction.user).auto_evidenceformat()