fix(aurora): fixed a few errors in addrole/immune
This commit is contained in:
parent
89a3e958b2
commit
d8def3cfc8
2 changed files with 8 additions and 8 deletions
|
@ -11,14 +11,14 @@ class Addrole(ui.View):
|
|||
|
||||
@ui.select(cls=ui.RoleSelect, placeholder="Select a role")
|
||||
async def addrole_select(self, interaction: Interaction, select: ui.RoleSelect,): # pylint: disable=unused-argument
|
||||
if not interaction.user.guild_permissions.manage_guild:
|
||||
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 add roles to the addrole whitelist.", ephemeral=True)
|
||||
return
|
||||
await interaction.response.defer()
|
||||
addrole_whitelist: list = await config.guild(self.ctx.guild).addrole_whitelist()
|
||||
if select.values[0] in addrole_whitelist:
|
||||
addrole_whitelist.remove(select.values[0])
|
||||
addrole_whitelist.remove(select.values[0].id)
|
||||
else:
|
||||
addrole_whitelist.append(select.values[0])
|
||||
await config.guild(self.ctx.guild).addrole_whitelist.set(int(select.values[0]))
|
||||
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))
|
||||
|
|
|
@ -11,14 +11,14 @@ class Immune(ui.View):
|
|||
|
||||
@ui.select(cls=ui.RoleSelect, placeholder="Select a role")
|
||||
async def immune_select(self, interaction: Interaction, select: ui.RoleSelect,): # pylint: disable=unused-argument
|
||||
if not interaction.user.guild_permissions.manage_guild:
|
||||
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 add immune roles.", ephemeral=True)
|
||||
return
|
||||
await interaction.response.defer()
|
||||
immune_roles: list = await config.guild(self.ctx.guild).immune_roles()
|
||||
if select.values[0] in immune_roles:
|
||||
immune_roles.remove(select.values[0])
|
||||
immune_roles.remove(select.values[0].id)
|
||||
else:
|
||||
immune_roles.append(select.values[0])
|
||||
await config.guild(self.ctx.guild).immune_roles.set(int(select.values[0]))
|
||||
immune_roles.append(select.values[0].id)
|
||||
await config.guild(self.ctx.guild).immune_roles.set(immune_roles)
|
||||
await interaction.message.edit(embed=await immune(self.ctx))
|
||||
|
|
Loading…
Reference in a new issue