Aurora Configuration Rewrite #15

Merged
cswimr merged 73 commits from aurora-config-rewrite into main 2024-01-16 12:19:08 -05:00
2 changed files with 14 additions and 4 deletions
Showing only changes of commit 3cbc8a744c - Show all commits

View file

@ -25,12 +25,15 @@ class Configuration(Mixin):
await ctx.send(embed=await overrides(ctx), view=Overrides(ctx)) await ctx.send(embed=await overrides(ctx), view=Overrides(ctx))
@aurora_settings.command(name="guild", aliases=["server"]) @aurora_settings.command(name="guild", aliases=["server"])
@commands.admin_or_permissions(manage_guild=True)
@commands.guild_only()
async def aurora_settings_guild(self, ctx: commands.Context): async def aurora_settings_guild(self, ctx: commands.Context):
"""Manage Aurora's guild settings.""" """Manage Aurora's guild settings."""
await ctx.send(embed=await guild(ctx)) await ctx.send(embed=await guild(ctx))
@aurora_settings.command(name="addrole", aliases=["removerole"]) @aurora_settings.command(name="addrole", aliases=["removerole"])
@commands.admin_or_permissions(manage_guild=True) @commands.admin_or_permissions(manage_guild=True)
@commands.guild_only()
async def aurora_settings_addrole(self, ctx: commands.Context): async def aurora_settings_addrole(self, ctx: commands.Context):
"""Manage the addrole whitelist. """Manage the addrole whitelist.
@ -39,6 +42,7 @@ class Configuration(Mixin):
@aurora_settings.command(name="immunity") @aurora_settings.command(name="immunity")
@commands.admin_or_permissions(manage_guild=True) @commands.admin_or_permissions(manage_guild=True)
@commands.guild_only()
async def aurora_settings_immunity(self, ctx: commands.Context): async def aurora_settings_immunity(self, ctx: commands.Context):
"""Manage the immunity whitelist.""" """Manage the immunity whitelist."""
await ctx.send(embed=await immune(ctx)) await ctx.send(embed=await immune(ctx))

View file

@ -42,7 +42,7 @@ async def overrides(ctx: commands.Context) -> Embed:
""" + override_str """ + override_str
return e return e
async def guild(ctx: commands.Context) -> str: async def guild(ctx: commands.Context) -> Embed:
"""Generates a configuration menu field value for a guild's settings.""" """Generates a configuration menu field value for a guild's settings."""
guild_settings = { guild_settings = {
@ -79,9 +79,15 @@ async def guild(ctx: commands.Context) -> str:
'- '+ bold("History Inline Pagesize: ") + get_pagesize_str(guild_settings['history_inline_pagesize']) '- '+ bold("History Inline Pagesize: ") + get_pagesize_str(guild_settings['history_inline_pagesize'])
] ]
guild_str = '\n'.join(guild_str) guild_str = '\n'.join(guild_str)
return guild_str
async def addrole(ctx: commands.Context) -> str: e = await _core(ctx)
e.title += ": Server Configuration"
e.description = """
Use the buttons below to manage Aurora's server configuration.\n
""" + guild_str
return e
async def addrole(ctx: commands.Context) -> Embed:
"""Generates a configuration menu field value for a guild's addrole whitelist.""" """Generates a configuration menu field value for a guild's addrole whitelist."""
whitelist = await config.guild(ctx.guild).addrole_roles() whitelist = await config.guild(ctx.guild).addrole_roles()
@ -114,7 +120,7 @@ async def addrole(ctx: commands.Context) -> str:
return e return e
async def immune(ctx: commands.Context) -> str: async def immune(ctx: commands.Context) -> Embed:
"""Generates a configuration menu field value for a guild's immune roles.""" """Generates a configuration menu field value for a guild's immune roles."""
immune_roles = await config.guild(ctx.guild).immune_roles() immune_roles = await config.guild(ctx.guild).immune_roles()