Compare commits

...

2 commits

Author SHA1 Message Date
7c69a89442
feat(aurora): added reset button to the types menu
All checks were successful
Actions / Build Documentation (MkDocs) (pull_request) Successful in 30s
Actions / Lint Code (Ruff & Pylint) (pull_request) Successful in 45s
2024-08-12 17:44:48 -04:00
290ac5947f
fix(aurora): actually fixed the previous TypeError 2024-08-12 17:44:39 -04:00
2 changed files with 13 additions and 4 deletions

View file

@ -56,3 +56,12 @@ class Types(ui.View):
current_setting = await config.custom("types", 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("types", 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))
@ui.button(label="Reset", style=ButtonStyle.red, row=1)
async def reset(self, interaction: Interaction, button: ui.Button): # pylint: disable=unused-argument
if not interaction.user.guild_permissions.manage_guild and not interaction.user.guild_permissions.administrator:
await interaction.response.send_message("You must have the manage guild permission to change this setting.", ephemeral=True)
return
await interaction.response.defer()
await config.custom("types", interaction.guild.id, self.type.key).clear()
await interaction.message.edit(embed=await type_embed(self.ctx, self.type))

View file

@ -29,10 +29,10 @@ def register_config(config_obj: Config):
) )
moderation_type = { moderation_type = {
"show_in_history": bool, "show_in_history": None,
"show_moderator": bool, "show_moderator": None,
"use_discord_permissions": bool, "use_discord_permissions": None,
"dm_users": bool, "dm_users": None,
} }
config_obj.init_custom("types", 2) config_obj.init_custom("types", 2)