'How do you make a specific role able to use a slash command in Nextcord?

How do you make a specific role able to use a slash command in Nextcord?

I have found using @command.has_permissions(manage_messages=True) doesn't work when using slash command in Nextcord eg:

@bot.slash_command(description="Hello")
@command.has_permissions(manage_messages=True)
async def hi(interaction : Interaction):
    await interaction.send("Hello!")

I have tested this using alt accounts without the appropriate permissions and the command still works.

Is this a Nextcord bug or is there a different way to do this using slash commands?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source