forked from blizzthewolf/SeaCogs
fix(aurora): fixed an issue with adding multiple immune roles/addrole roles at once
This commit is contained in:
parent
06e011f670
commit
97b54b507b
2 changed files with 14 additions and 13 deletions
|
@ -17,12 +17,13 @@ class Addrole(ui.View):
|
||||||
await interaction.response.send_message(error("You must have the manage guild permission to add roles to the addrole whitelist."), ephemeral=True)
|
await interaction.response.send_message(error("You must have the manage guild permission to add roles to the addrole whitelist."), ephemeral=True)
|
||||||
return
|
return
|
||||||
await interaction.response.defer()
|
await interaction.response.defer()
|
||||||
addrole_whitelist: list = await config.guild(self.ctx.guild).addrole_whitelist()
|
async with config.guild(self.ctx.guild).addrole_whitelist() as addrole_whitelist:
|
||||||
if select.values[0].id in addrole_whitelist:
|
addrole_whitelist: list # type hint
|
||||||
addrole_whitelist.remove(select.values[0].id)
|
for value in select.values:
|
||||||
|
if value.id in addrole_whitelist:
|
||||||
|
addrole_whitelist.remove(value.id)
|
||||||
else:
|
else:
|
||||||
addrole_whitelist.append(select.values[0].id)
|
addrole_whitelist.append(value.id)
|
||||||
await config.guild(self.ctx.guild).addrole_whitelist.set(addrole_whitelist)
|
|
||||||
await interaction.message.edit(embed=await addrole_embed(self.ctx))
|
await interaction.message.edit(embed=await addrole_embed(self.ctx))
|
||||||
|
|
||||||
@ui.button(label="Clear", style=ButtonStyle.red, row=1)
|
@ui.button(label="Clear", style=ButtonStyle.red, row=1)
|
||||||
|
|
|
@ -17,13 +17,13 @@ class Immune(ui.View):
|
||||||
await interaction.response.send_message(error("You must have the manage guild permission to add immune roles."), ephemeral=True)
|
await interaction.response.send_message(error("You must have the manage guild permission to add immune roles."), ephemeral=True)
|
||||||
return
|
return
|
||||||
await interaction.response.defer()
|
await interaction.response.defer()
|
||||||
immune_roles: list = await config.guild(self.ctx.guild).immune_roles()
|
async with config.guild(self.ctx.guild).immune_roles() as immune_roles:
|
||||||
for role in select.values:
|
immune_roles: list # type hint
|
||||||
if role.id in immune_roles:
|
for value in select.values:
|
||||||
immune_roles.remove(role.id)
|
if value.id in immune_roles:
|
||||||
|
immune_roles.remove(value.id)
|
||||||
else:
|
else:
|
||||||
immune_roles.append(role.id)
|
immune_roles.append(value.id)
|
||||||
await config.guild(self.ctx.guild).immune_roles.set(immune_roles)
|
|
||||||
await interaction.message.edit(embed=await immune_embed(self.ctx))
|
await interaction.message.edit(embed=await immune_embed(self.ctx))
|
||||||
|
|
||||||
@ui.button(label="Clear", style=ButtonStyle.red, row=1)
|
@ui.button(label="Clear", style=ButtonStyle.red, row=1)
|
||||||
|
|
Loading…
Reference in a new issue