This commit is contained in:
insert 2024-08-10 16:37:05 -04:00
parent 9a522aa71d
commit 08986386b3
Signed by: insert
GPG key ID: A70775C389ACF105

View file

@ -60,7 +60,7 @@ class rolebutton(commands.Cog):
await interaction.response.send_message(view=RoleView(self.bot)) await interaction.response.send_message(view=RoleView(self.bot))
@nextcord.message_command( @nextcord.message_command(
name="refresh role buttons", name="Refresh role buttons",
default_member_permissions=nextcord.Permissions(manage_roles=True), default_member_permissions=nextcord.Permissions(manage_roles=True),
) )
@nextcord.ext.application_checks.has_permissions(manage_roles=True) @nextcord.ext.application_checks.has_permissions(manage_roles=True)
@ -71,8 +71,10 @@ class rolebutton(commands.Cog):
res = await self.bot.cur.execute(f"SELECT roleid FROM rolebutton WHERE serverid = {interaction.guild.id}") res = await self.bot.cur.execute(f"SELECT roleid FROM rolebutton WHERE serverid = {interaction.guild.id}")
res = await res.fetchall() res = await res.fetchall()
buttonlist.clear() buttonlist.clear()
for r in res: for [r] in res:
button = nextcord.ui.Button(label="r", style=nextcord.ButtonStyle.gray, custom_id=f"rolebutton:{r}") role = interaction.guild.get_role(int(r))
role.name
button = nextcord.ui.Button(label=role.name, style=nextcord.ButtonStyle.gray, custom_id=f"rolebutton:{role.id}")
buttonlist.append(button) buttonlist.append(button)
await message.edit(view=RoleView(self.bot)) await message.edit(view=RoleView(self.bot))
await interaction.response.send_message("Edited!", ephemeral=True) await interaction.response.send_message("Edited!", ephemeral=True)