From 900eb16aa9553d76403fc360206d20bb2b7730fa Mon Sep 17 00:00:00 2001 From: SeaswimmerTheFsh Date: Mon, 15 Jan 2024 15:01:20 +0000 Subject: [PATCH] fix(aurora): fixed circular import --- aurora/configuration/commands.py | 16 ++++++++++------ aurora/configuration/embed.py | 9 +++------ 2 files changed, 13 insertions(+), 12 deletions(-) diff --git a/aurora/configuration/commands.py b/aurora/configuration/commands.py index 1342bf5..4b99561 100644 --- a/aurora/configuration/commands.py +++ b/aurora/configuration/commands.py @@ -1,10 +1,11 @@ from redbot.core import commands from redbot.core.utils.chat_formatting import error, warning -from .embed import addrole_embed, embed, immune_embed -from ..abc import Mixin -from ..importers.aurora import ImportAuroraView -from ..importers.galacticbot import ImportGalacticBotView +from aurora.configuration.menus.core import Overrides +from aurora.configuration.embed import addrole_embed, embed, immune_embed +from aurora.abc import Mixin +from aurora.importers.aurora import ImportAuroraView +from aurora.importers.galacticbot import ImportGalacticBotView class Configuration(Mixin): @@ -21,8 +22,11 @@ class Configuration(Mixin): @aurora_settings.command(name="core") async def aurora_settings_core(self, ctx: commands.Context): """Manage Aurora's core settings.""" - menu = await embed(ctx) - await ctx.send(embed=menu[0], view=menu[1]) + if ctx.guild is not None and (ctx.author.guild_permissions.administrator or ctx.author.guild_permissions.manage_guild): + view = None + else: + view = Overrides(ctx) + await ctx.send(embed=await embed(ctx), view=view) @aurora_settings.command(name="addrole", aliases=["removerole"]) @commands.admin_or_permissions(manage_guild=True) diff --git a/aurora/configuration/embed.py b/aurora/configuration/embed.py index 0600fb9..e6eeca3 100644 --- a/aurora/configuration/embed.py +++ b/aurora/configuration/embed.py @@ -1,10 +1,9 @@ from typing import Union -from discord import Embed, Guild, Member, User, ui +from discord import Embed, Guild, Member, User from redbot.core import commands from redbot.core.utils.chat_formatting import bold, error, warning -from aurora.configuration.menus.core import Overrides from aurora.configuration.utils import get_bool_emoji, get_pagesize_str from aurora.utilities.config import config @@ -101,15 +100,13 @@ async def _immune(guild: Guild) -> str: immune = warning("No roles are set as immune roles!") return immune -async def embed(ctx: commands.Context) -> (Embed, ui.View): +async def embed(ctx: commands.Context) -> Embed: """Generates the configuration embed for a guild.""" e = await _core(ctx) e.add_field(name="User Overrides", value=await _overrides(ctx.author), inline=False) - view = Overrides(ctx) if ctx.guild is not None and (ctx.author.guild_permissions.administrator or ctx.author.guild_permissions.manage_guild): e.add_field(name="Guild Settings", value=await _guild(ctx.guild), inline=False) - view = None - return (e, view) + return e async def addrole_embed(ctx: commands.Context) -> Embed: """Generates the addrole embed for a guild."""