Aurora Configuration Rewrite #15
3 changed files with 8 additions and 8 deletions
|
@ -10,15 +10,15 @@ class Addrole(ui.View):
|
|||
self.ctx = ctx
|
||||
|
||||
@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,):
|
||||
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:
|
||||
if select.values[0].id in addrole_whitelist:
|
||||
addrole_whitelist.remove(select.values[0].id)
|
||||
else:
|
||||
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))
|
||||
await interaction.message.edit(embed=await addrole(self.ctx), view=Addrole(self.ctx))
|
||||
|
|
|
@ -10,15 +10,15 @@ class Immune(ui.View):
|
|||
self.ctx = ctx
|
||||
|
||||
@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,):
|
||||
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:
|
||||
if select.values[0].id in immune_roles:
|
||||
immune_roles.remove(select.values[0].id)
|
||||
else:
|
||||
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))
|
||||
await interaction.message.edit(embed=await immune(self.ctx), view=Immune(self.ctx))
|
||||
|
|
|
@ -56,7 +56,7 @@ class Overrides(ui.View):
|
|||
await interaction.message.edit(embed=await overrides(self.ctx))
|
||||
|
||||
@ui.select(placeholder="Inline Pagesize", options=create_pagesize_options(), row=1)
|
||||
async def inline_pagesize(self, interaction: Interaction, select: ui.Select,): # pylint: disable=unused-argument
|
||||
async def inline_pagesize(self, interaction: Interaction, select: ui.Select,):
|
||||
if self.ctx.author != interaction.user:
|
||||
await interaction.response.send_message("You cannot change this setting for other users.", ephemeral=True)
|
||||
return
|
||||
|
@ -68,7 +68,7 @@ class Overrides(ui.View):
|
|||
await interaction.message.edit(embed=await overrides(self.ctx))
|
||||
|
||||
@ui.select(placeholder="Pagesize", options=create_pagesize_options(), row=2)
|
||||
async def pagesize(self, interaction: Interaction, select: ui.Select,): # pylint: disable=unused-argument
|
||||
async def pagesize(self, interaction: Interaction, select: ui.Select,):
|
||||
if self.ctx.author != interaction.user:
|
||||
await interaction.response.send_message("You cannot change this setting for other users.", ephemeral=True)
|
||||
return
|
||||
|
|
Loading…
Reference in a new issue