fix(aurora): pylint fixes
All checks were successful
Actions / Lint Code (Pylint) (pull_request) Successful in 16s
Actions / Build Documentation (MkDocs) (pull_request) Successful in 12s

This commit is contained in:
Seaswimmer 2024-01-16 14:26:54 +00:00
parent 46a290aad3
commit 950d4abf6a
Signed by: cswimr
GPG key ID: D74DDDDF420E13DF
6 changed files with 38 additions and 38 deletions

View file

@ -29,7 +29,7 @@ from aurora.menus.immune import Immune
from aurora.menus.overrides import Overrides
from aurora.utilities.config import config, register_config
from aurora.utilities.database import connect, create_guild_table, fetch_case, mysql_log
from aurora.utilities.factory import case_factory, changes_factory, evidenceformat_factory, message_factory, overrides, immune, guild, addrole
from aurora.utilities.factory import case_factory, changes_factory, evidenceformat_factory, message_factory, overrides_embed, immune_embed, guild_embed, addrole_embed
from aurora.utilities.logger import logger
from aurora.utilities.utils import convert_timedelta_to_str, check_moddable, check_permissions, fetch_channel_dict, fetch_user_dict, generate_dict, log, send_evidenceformat
@ -1038,14 +1038,14 @@ class Aurora(commands.Cog):
@aurora_settings.command(name="overrides", aliases=["override", "user"])
async def aurora_settings_overrides(self, ctx: commands.Context):
"""Manage Aurora's user overriddable settings."""
await ctx.send(embed=await overrides(ctx), view=Overrides(ctx))
await ctx.send(embed=await overrides_embed(ctx), view=Overrides(ctx))
@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):
"""Manage Aurora's guild settings."""
await ctx.send(embed=await guild(ctx), view=Guild(ctx))
await ctx.send(embed=await guild_embed(ctx), view=Guild(ctx))
@aurora_settings.command(name="addrole", aliases=["removerole"])
@commands.admin_or_permissions(manage_guild=True)
@ -1054,14 +1054,14 @@ class Aurora(commands.Cog):
"""Manage the addrole whitelist.
Roles added to this list are also applied to `/removerole`."""
await ctx.send(embed=await addrole(ctx), view=Addrole(ctx))
await ctx.send(embed=await addrole_embed(ctx), view=Addrole(ctx))
@aurora_settings.command(name="immunity")
@commands.admin_or_permissions(manage_guild=True)
@commands.guild_only()
async def aurora_settings_immunity(self, ctx: commands.Context):
"""Manage the immunity whitelist."""
await ctx.send(embed=await immune(ctx), view=Immune(ctx))
await ctx.send(embed=await immune_embed(ctx), view=Immune(ctx))
@aurora.group(autohelp=True, name="import")
@commands.admin()

View file

@ -2,7 +2,7 @@ from discord import ButtonStyle, ui, Interaction
from redbot.core import commands
from redbot.core.utils.chat_formatting import error
from aurora.utilities.factory import addrole
from aurora.utilities.factory import addrole_embed
from aurora.utilities.config import config
class Addrole(ui.View):
@ -22,7 +22,7 @@ class Addrole(ui.View):
else:
addrole_whitelist.append(select.values[0].id)
await config.guild(self.ctx.guild).addrole_whitelist.set(addrole_whitelist)
await interaction.message.edit(embed=await addrole(self.ctx))
await interaction.message.edit(embed=await addrole_embed(self.ctx))
@ui.button(label="Clear", style=ButtonStyle.red, row=1)
async def clear(self, interaction: Interaction, button: ui.Button): # pylint: disable=unused-argument
@ -31,7 +31,7 @@ class Addrole(ui.View):
return
await interaction.response.defer()
await config.guild(self.ctx.guild).addrole_whitelist.clear()
await interaction.message.edit(embed=await addrole(self.ctx))
await interaction.message.edit(embed=await addrole_embed(self.ctx))
@ui.button(label="Close", style=ButtonStyle.gray)
async def close(self, interaction: Interaction, button: ui.Button): # pylint: disable=unused-argument

View file

@ -1,7 +1,7 @@
from discord import ui, ButtonStyle, Interaction
from redbot.core import commands
from aurora.utilities.factory import guild
from aurora.utilities.factory import guild_embed
from aurora.utilities.utils import create_pagesize_options
from aurora.utilities.config import config
@ -18,7 +18,7 @@ class Guild(ui.View):
await interaction.response.defer()
current_setting = await config.guild(interaction.guild).show_moderator
await config.guild(interaction.guild).show_moderator.set(not current_setting)
await interaction.message.edit(embed=await guild(self.ctx))
await interaction.message.edit(embed=await guild_embed(self.ctx))
@ui.button(label="Use Discord Permissions", style=ButtonStyle.green, row=0)
async def use_discord_permissions(self, interaction: Interaction, button: ui.Button): # pylint: disable=unused-argument
@ -28,7 +28,7 @@ class Guild(ui.View):
await interaction.response.defer()
current_setting = await config.guild(interaction.guild).use_discord_permissions()
await config.guild(interaction.guild).use_discord_permissions.set(not current_setting)
await interaction.message.edit(embed=await guild(self.ctx))
await interaction.message.edit(embed=await guild_embed(self.ctx))
@ui.button(label="Ignore Modlog", style=ButtonStyle.green, row=0)
async def ignore_modlog(self, interaction: Interaction, button: ui.Button): # pylint: disable=unused-argument
@ -38,7 +38,7 @@ class Guild(ui.View):
await interaction.response.defer()
current_setting = await config.guild(interaction.guild).ignore_modlog()
await config.guild(interaction.guild).ignore_modlog.set(not current_setting)
await interaction.message.edit(embed=await guild(self.ctx))
await interaction.message.edit(embed=await guild_embed(self.ctx))
@ui.button(label="Ignore Other Bots", style=ButtonStyle.green, row=0)
async def ignore_other_bots(self, interaction: Interaction, button: ui.Button): # pylint: disable=unused-argument
@ -48,7 +48,7 @@ class Guild(ui.View):
await interaction.response.defer()
current_setting = await config.guild(interaction.guild).ignore_other_bots()
await config.guild(interaction.guild).ignore_other_bots.set(not current_setting)
await interaction.message.edit(embed=await guild(self.ctx))
await interaction.message.edit(embed=await guild_embed(self.ctx))
@ui.button(label="DM Users", style=ButtonStyle.green, row=1)
async def dm_users(self, interaction: Interaction, button: ui.Button): # pylint: disable=unused-argument
@ -58,7 +58,7 @@ class Guild(ui.View):
await interaction.response.defer()
current_setting = await config.guild(interaction.guild).dm_users()
await config.guild(interaction.guild).dm_users.set(not current_setting)
await interaction.message.edit(embed=await guild(self.ctx))
await interaction.message.edit(embed=await guild_embed(self.ctx))
@ui.button(label="Auto Evidence Format", style=ButtonStyle.green, row=1)
async def auto_evidenceformat(self, interaction: Interaction, button: ui.Button): # pylint: disable=unused-argument
@ -68,7 +68,7 @@ class Guild(ui.View):
await interaction.response.defer()
current_setting = await config.guild(interaction.guild).auto_evidenceformat()
await config.guild(interaction.guild).auto_evidenceformat.set(not current_setting)
await interaction.message.edit(embed=await guild(self.ctx))
await interaction.message.edit(embed=await guild_embed(self.ctx))
@ui.button(label="Ephemeral", style=ButtonStyle.green, row=1)
async def ephemeral(self, interaction: Interaction, button: ui.Button): # pylint: disable=unused-argument
@ -78,7 +78,7 @@ class Guild(ui.View):
await interaction.response.defer()
current_setting = await config.guild(interaction.guild).history_ephemeral()
await config.guild(interaction.guild).history_ephemeral.set(not current_setting)
await interaction.message.edit(embed=await guild(self.ctx))
await interaction.message.edit(embed=await guild_embed(self.ctx))
@ui.button(label="History Inline", style=ButtonStyle.green, row=1)
async def inline(self, interaction: Interaction, button: ui.Button): # pylint: disable=unused-argument
@ -88,7 +88,7 @@ class Guild(ui.View):
await interaction.response.defer()
current_setting = await config.guild(interaction.guild).history_inline()
await config.guild(interaction.guild).history_inline.set(not current_setting)
await interaction.message.edit(embed=await guild(self.ctx))
await interaction.message.edit(embed=await guild_embed(self.ctx))
@ui.select(placeholder="History Pagesize", options=create_pagesize_options(), row=2)
async def pagesize(self, interaction: Interaction, select: ui.Select,):
@ -100,7 +100,7 @@ class Guild(ui.View):
else:
await config.guild(interaction.guild).history_pagesize.set(int(select.values[0]))
await interaction.response.defer()
await interaction.message.edit(embed=await guild(self.ctx))
await interaction.message.edit(embed=await guild_embed(self.ctx))
@ui.select(placeholder="History Inline Pagesize", options=create_pagesize_options(), row=3)
async def inline_pagesize(self, interaction: Interaction, select: ui.Select,):
@ -112,7 +112,7 @@ class Guild(ui.View):
else:
await config.guild(interaction.guild).history_inline_pagesize.set(int(select.values[0]))
await interaction.response.defer()
await interaction.message.edit(embed=await guild(self.ctx))
await interaction.message.edit(embed=await guild_embed(self.ctx))
@ui.select(placeholder="Log Channel", cls=ui.ChannelSelect, row=4)
async def log_channel(self, interaction: Interaction, select: ui.ChannelSelect):
@ -121,4 +121,4 @@ class Guild(ui.View):
return
await interaction.response.defer()
await config.guild(interaction.guild).log_channel.set(select.values[0].id)
await interaction.message.edit(embed=await guild(self.ctx))
await interaction.message.edit(embed=await guild_embed(self.ctx))

View file

@ -2,7 +2,7 @@ from discord import ButtonStyle, ui, Interaction
from redbot.core import commands
from redbot.core.utils.chat_formatting import error
from aurora.utilities.factory import immune
from aurora.utilities.factory import immune_embed
from aurora.utilities.config import config
class Immune(ui.View):
@ -23,7 +23,7 @@ class Immune(ui.View):
else:
immune_roles.append(role.id)
await config.guild(self.ctx.guild).immune_roles.set(immune_roles)
await interaction.message.edit(embed=await immune(self.ctx))
await interaction.message.edit(embed=await immune_embed(self.ctx))
@ui.button(label="Clear", style=ButtonStyle.red, row=1)
async def clear(self, interaction: Interaction, button: ui.Button): # pylint: disable=unused-argument
@ -32,7 +32,7 @@ class Immune(ui.View):
return
await interaction.response.defer()
await config.guild(self.ctx.guild).immune_roles.clear()
await interaction.message.edit(embed=await immune(self.ctx))
await interaction.message.edit(embed=await immune_embed(self.ctx))
@ui.button(label="Close", style=ButtonStyle.gray)
async def close(self, interaction: Interaction, button: ui.Button): # pylint: disable=unused-argument

View file

@ -1,7 +1,7 @@
from discord import ui, ButtonStyle, Interaction
from redbot.core import commands
from aurora.utilities.factory import overrides
from aurora.utilities.factory import overrides_embed
from aurora.utilities.utils import create_pagesize_options
from aurora.utilities.config import config
@ -23,7 +23,7 @@ class Overrides(ui.View):
await config.user(self.ctx.author).auto_evidenceformat.set(True)
else:
await config.user(self.ctx.author).auto_evidenceformat.set(False)
await interaction.message.edit(embed=await overrides(self.ctx))
await interaction.message.edit(embed=await overrides_embed(self.ctx))
@ui.button(label="Ephemeral", style=ButtonStyle.green, row=0)
async def ephemeral(self, interaction: Interaction, button: ui.Button): # pylint: disable=unused-argument
@ -38,7 +38,7 @@ class Overrides(ui.View):
await config.user(self.ctx.author).history_ephemeral.set(True)
else:
await config.user(self.ctx.author).history_ephemeral.set(False)
await interaction.message.edit(embed=await overrides(self.ctx))
await interaction.message.edit(embed=await overrides_embed(self.ctx))
@ui.button(label="Inline", style=ButtonStyle.green, row=0)
async def inline(self, interaction: Interaction, button: ui.Button): # pylint: disable=unused-argument
@ -53,7 +53,7 @@ class Overrides(ui.View):
await config.user(self.ctx.author).history_inline.set(True)
else:
await config.user(self.ctx.author).history_inline.set(False)
await interaction.message.edit(embed=await overrides(self.ctx))
await interaction.message.edit(embed=await overrides_embed(self.ctx))
@ui.select(placeholder="Inline Pagesize", options=create_pagesize_options(), row=1)
async def inline_pagesize(self, interaction: Interaction, select: ui.Select,):
@ -65,7 +65,7 @@ class Overrides(ui.View):
await config.user(self.ctx.author).history_inline_pagesize.clear()
else:
await config.user(self.ctx.author).history_inline_pagesize.set(int(select.values[0]))
await interaction.message.edit(embed=await overrides(self.ctx))
await interaction.message.edit(embed=await overrides_embed(self.ctx))
@ui.select(placeholder="Pagesize", options=create_pagesize_options(), row=2)
async def pagesize(self, interaction: Interaction, select: ui.Select,):
@ -77,4 +77,4 @@ class Overrides(ui.View):
await config.user(self.ctx.author).history_pagesize.clear()
else:
await config.user(self.ctx.author).history_pagesize.set(int(select.values[0]))
await interaction.message.edit(embed=await overrides(self.ctx))
await interaction.message.edit(embed=await overrides_embed(self.ctx))

View file

@ -230,7 +230,7 @@ async def evidenceformat_factory(interaction: Interaction, case_dict: dict) -> s
### Configuration Embeds #
########################################################################################################################
async def _core(ctx: commands.Context) -> Embed:
async def _config(ctx: commands.Context) -> Embed:
"""Generates the core embed for configuration menus to use."""
e = Embed(
title="Aurora Configuration Menu",
@ -239,7 +239,7 @@ async def _core(ctx: commands.Context) -> Embed:
e.set_thumbnail(url=ctx.bot.user.display_avatar.url)
return e
async def overrides(ctx: commands.Context) -> Embed:
async def overrides_embed(ctx: commands.Context) -> Embed:
"""Generates a configuration menu embed for a user's overrides."""
override_settings = {
@ -259,7 +259,7 @@ async def overrides(ctx: commands.Context) -> Embed:
]
override_str = '\n'.join(override_str)
e = await _core(ctx)
e = await _config(ctx)
e.title += ": User Overrides"
e.description = """
Use the buttons below to manage your user overrides.
@ -267,7 +267,7 @@ async def overrides(ctx: commands.Context) -> Embed:
""" + override_str
return e
async def guild(ctx: commands.Context) -> Embed:
async def guild_embed(ctx: commands.Context) -> Embed:
"""Generates a configuration menu field value for a guild's settings."""
guild_settings = {
@ -305,14 +305,14 @@ async def guild(ctx: commands.Context) -> Embed:
]
guild_str = '\n'.join(guild_str)
e = await _core(ctx)
e = await _config(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:
async def addrole_embed(ctx: commands.Context) -> Embed:
"""Generates a configuration menu field value for a guild's addrole whitelist."""
whitelist = await config.guild(ctx.guild).addrole_whitelist()
@ -322,7 +322,7 @@ async def addrole(ctx: commands.Context) -> Embed:
else:
whitelist = warning("No roles are on the addrole whitelist!")
e = await _core(ctx)
e = await _config(ctx)
e.title += ": Addrole Whitelist"
e.description = "Use the select menu below to manage this guild's addrole whitelist."
@ -345,7 +345,7 @@ async def addrole(ctx: commands.Context) -> Embed:
return e
async def immune(ctx: commands.Context) -> Embed:
async def immune_embed(ctx: commands.Context) -> Embed:
"""Generates a configuration menu field value for a guild's immune roles."""
immune_roles = await config.guild(ctx.guild).immune_roles()
@ -355,7 +355,7 @@ async def immune(ctx: commands.Context) -> Embed:
else:
immune_str = warning("No roles are set as immune roles!")
e = await _core(ctx)
e = await _config(ctx)
e.title += ": Immune Roles"
e.description = "Use the select menu below to manage this guild's immune roles."