fix(aurora): fixed circular import
All checks were successful
Actions / Lint Code (Pylint) (pull_request) Successful in 14s
Actions / Build Documentation (MkDocs) (pull_request) Successful in 10s

This commit is contained in:
Seaswimmer 2024-01-15 15:01:20 +00:00
parent 14705efddd
commit 900eb16aa9
Signed by: cswimr
GPG key ID: D74DDDDF420E13DF
2 changed files with 13 additions and 12 deletions

View file

@ -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)

View file

@ -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."""