diff --git a/rolebuttons.py b/rolebuttons.py index 0f51c88..f63e026 100644 --- a/rolebuttons.py +++ b/rolebuttons.py @@ -55,14 +55,13 @@ class rolebutton(commands.Cog): self.bot.roleguild = interaction.guild await interaction.response.send_message(view=RoleView(self.bot)) - @rolebuttons.subcommand( + @nextcord.message_command( name="refresh", description="refresh a role selection message", ) - async def rolerefresh(self, interaction: nextcord.Interaction, msgid): - msgid = int(msgid) - msg = await nextcord.abc.Messageable.fetch_message(self.bot, msgid) - if msg.author.id != self.bot.application_id: + @nextcord.ext.application_checks.has_permissions(manage_roles=True) + async def rolerefresh(self, interaction: nextcord.Interaction, message: nextcord.Message): + if message.author.id != self.bot.application_id: await interaction.response.send_message("I can't edit that message", ephemeral=True) return res = await self.bot.cur.execute(f"SELECT roleid FROM rolebutton WHERE serverid = {interaction.guild.id}") @@ -71,7 +70,7 @@ class rolebutton(commands.Cog): button = nextcord.ui.Button(label="r", style=nextcord.ButtonStyle.gray, custom_id=f"rolebutton:{r}") button.callback = RoleView.buttoncallback RoleView.add_item(button) - await msg.edit(view=RoleView(self.bot)) + await message.edit(view=RoleView(self.bot)) await interaction.response.send_message("Edited!", ephemeral=True) @rolebuttons.subcommand(