diff --git a/rolebuttons.py b/rolebuttons.py index 6995890..fb93967 100644 --- a/rolebuttons.py +++ b/rolebuttons.py @@ -60,7 +60,7 @@ class rolebutton(commands.Cog): await interaction.response.send_message(view=RoleView(self.bot)) @nextcord.message_command( - name="refresh role buttons", + name="Refresh role buttons", default_member_permissions=nextcord.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 res.fetchall() buttonlist.clear() - for r in res: - button = nextcord.ui.Button(label="r", style=nextcord.ButtonStyle.gray, custom_id=f"rolebutton:{r}") + for [r] in res: + 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) await message.edit(view=RoleView(self.bot)) await interaction.response.send_message("Edited!", ephemeral=True)