feat(aurora): added reset button to the types menu
This commit is contained in:
parent
290ac5947f
commit
7c69a89442
1 changed files with 9 additions and 0 deletions
|
@ -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))
|
||||||
|
|
Loading…
Reference in a new issue