WIP: Refactor Aurora (3.0.0) #29

Draft
cswimr wants to merge 347 commits from aurora-pydantic into main
3 changed files with 14 additions and 14 deletions
Showing only changes of commit c134a3ed18 - Show all commits

View file

@ -23,8 +23,8 @@ class Types(ui.View):
await interaction.response.send_message("You must have the manage guild permission to change this setting.", ephemeral=True) await interaction.response.send_message("You must have the manage guild permission to change this setting.", ephemeral=True)
return return
await interaction.response.defer() await interaction.response.defer()
current_setting = await config.custom("type", interaction.guild.id, self.type.key).show_in_history() current_setting = await config.custom("types", interaction.guild.id, self.type.key).show_in_history()
await config.custom("type", interaction.guild.id, self.type.key).show_in_history.set(not current_setting) await config.custom("types", interaction.guild.id, self.type.key).show_in_history.set(not current_setting)
await interaction.message.edit(embed=await type_embed(self.ctx, self.type)) await interaction.message.edit(embed=await type_embed(self.ctx, self.type))
@ui.button(label="Show Moderator", style=ButtonStyle.green, row=0) @ui.button(label="Show Moderator", style=ButtonStyle.green, row=0)
@ -33,8 +33,8 @@ class Types(ui.View):
await interaction.response.send_message("You must have the manage guild permission to change this setting.", ephemeral=True) await interaction.response.send_message("You must have the manage guild permission to change this setting.", ephemeral=True)
return return
await interaction.response.defer() await interaction.response.defer()
current_setting = await config.custom("type", interaction.guild.id, self.type.key).show_moderator() current_setting = await config.custom("types", interaction.guild.id, self.type.key).show_moderator()
await config.custom("type", interaction.guild.id, self.type.key).show_moderator.set(not current_setting) await config.custom("types", interaction.guild.id, self.type.key).show_moderator.set(not current_setting)
await interaction.message.edit(embed=await type_embed(self.ctx, self.type)) await interaction.message.edit(embed=await type_embed(self.ctx, self.type))
@ui.button(label="Use Discord Permissions", style=ButtonStyle.green, row=0) @ui.button(label="Use Discord Permissions", style=ButtonStyle.green, row=0)
@ -43,8 +43,8 @@ class Types(ui.View):
await interaction.response.send_message("You must have the manage guild permission to change this setting.", ephemeral=True) await interaction.response.send_message("You must have the manage guild permission to change this setting.", ephemeral=True)
return return
await interaction.response.defer() await interaction.response.defer()
current_setting = await config.custom("type", interaction.guild.id, self.type.key).use_discord_permissions() current_setting = await config.custom("types", interaction.guild.id, self.type.key).use_discord_permissions()
await config.custom("type", interaction.guild.id, self.type.key).use_discord_permissions.set(not current_setting) await config.custom("types", interaction.guild.id, self.type.key).use_discord_permissions.set(not current_setting)
await interaction.message.edit(embed=await type_embed(self.ctx, self.type)) await interaction.message.edit(embed=await type_embed(self.ctx, self.type))
@ui.button(label="DM Users", style=ButtonStyle.green, row=0) @ui.button(label="DM Users", style=ButtonStyle.green, row=0)
@ -53,6 +53,6 @@ class Types(ui.View):
await interaction.response.send_message("You must have the manage guild permission to change this setting.", ephemeral=True) await interaction.response.send_message("You must have the manage guild permission to change this setting.", ephemeral=True)
return return
await interaction.response.defer() await interaction.response.defer()
current_setting = await config.custom("type", interaction.guild.id, self.type.key).dm_users() current_setting = await config.custom("types", interaction.guild.id, self.type.key).dm_users()
await config.custom("type", interaction.guild.id, self.type.key).dm_users.set(not current_setting) await config.custom("types", interaction.guild.id, self.type.key).dm_users.set(not current_setting)
await interaction.message.edit(embed=await type_embed(self.ctx, self.type)) await interaction.message.edit(embed=await type_embed(self.ctx, self.type))

View file

@ -35,5 +35,5 @@ def register_config(config_obj: Config):
"dm_users": bool, "dm_users": bool,
} }
config_obj.init_custom("type", 2) config_obj.init_custom("types", 2)
config_obj.register_custom("type", **moderation_type) config_obj.register_custom("types", **moderation_type)

View file

@ -549,10 +549,10 @@ async def type_embed(ctx: commands.Context, moderation_type = Type) -> Embed:
"""Generates a configuration menu field value for a guild's settings.""" """Generates a configuration menu field value for a guild's settings."""
type_settings = { type_settings = {
"show_in_history": await config.custom("type", ctx.guild.id, moderation_type.key).show_in_history(), "show_in_history": await config.custom("types", ctx.guild.id, moderation_type.key).show_in_history(),
"show_moderator": await config.custom("type", ctx.guild.id, moderation_type.key).show_moderator(), "show_moderator": await config.custom("types", ctx.guild.id, moderation_type.key).show_moderator(),
"use_discord_permissions": await config.custom("type", ctx.guild.id, moderation_type.key).use_discord_permissions(), "use_discord_permissions": await config.custom("types", ctx.guild.id, moderation_type.key).use_discord_permissions(),
"dm_users": await config.custom("type", ctx.guild.id, moderation_type.key).dm_users(), "dm_users": await config.custom("types", ctx.guild.id, moderation_type.key).dm_users(),
} }
guild_str = [ guild_str = [