fix(aurora): fixed a few errors in addrole/immune
Some checks failed
Actions / Lint Code (Pylint) (pull_request) Failing after 15s
Actions / Build Documentation (MkDocs) (pull_request) Successful in 11s

This commit is contained in:
Seaswimmer 2024-01-16 13:03:51 +00:00
parent 89a3e958b2
commit d8def3cfc8
Signed by: cswimr
GPG key ID: D74DDDDF420E13DF
2 changed files with 8 additions and 8 deletions

View file

@ -11,14 +11,14 @@ class Addrole(ui.View):
@ui.select(cls=ui.RoleSelect, placeholder="Select a role") @ui.select(cls=ui.RoleSelect, placeholder="Select a role")
async def addrole_select(self, interaction: Interaction, select: ui.RoleSelect,): # pylint: disable=unused-argument 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) await interaction.response.send_message("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() addrole_whitelist: list = await config.guild(self.ctx.guild).addrole_whitelist()
if select.values[0] in addrole_whitelist: if select.values[0] in addrole_whitelist:
addrole_whitelist.remove(select.values[0]) addrole_whitelist.remove(select.values[0].id)
else: else:
addrole_whitelist.append(select.values[0]) addrole_whitelist.append(select.values[0].id)
await config.guild(self.ctx.guild).addrole_whitelist.set(int(select.values[0])) await config.guild(self.ctx.guild).addrole_whitelist.set(addrole_whitelist)
await interaction.message.edit(embed=await addrole(self.ctx)) await interaction.message.edit(embed=await addrole(self.ctx))

View file

@ -11,14 +11,14 @@ class Immune(ui.View):
@ui.select(cls=ui.RoleSelect, placeholder="Select a role") @ui.select(cls=ui.RoleSelect, placeholder="Select a role")
async def immune_select(self, interaction: Interaction, select: ui.RoleSelect,): # pylint: disable=unused-argument 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) await interaction.response.send_message("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() immune_roles: list = await config.guild(self.ctx.guild).immune_roles()
if select.values[0] in immune_roles: if select.values[0] in immune_roles:
immune_roles.remove(select.values[0]) immune_roles.remove(select.values[0].id)
else: else:
immune_roles.append(select.values[0]) immune_roles.append(select.values[0].id)
await config.guild(self.ctx.guild).immune_roles.set(int(select.values[0])) await config.guild(self.ctx.guild).immune_roles.set(immune_roles)
await interaction.message.edit(embed=await immune(self.ctx)) await interaction.message.edit(embed=await immune(self.ctx))