#Button Permissions

1 messages · Page 1 of 1 (latest)

ivory ivy
#

Hey, how i can use button with permissions? So the button must be have permissions to only use is the author for example.

I thought of an if query, but is there something for that directly in the button?

pulsar arrow
#

override interaction_check and do an if

#

return True or False

ivory ivy
#

uh okay thanks

ivory ivy
# pulsar arrow override interaction_check and do an if
class test_button(discord.ui.View):

    @discord.ui.button(label="Tets")
    async def interaction_check(self, interaction: discord.Interaction):
        if interaction.user != interaction.author:
            print("Not Perms")
            return
        else:
            await interaction.response.send_message(f"Test")

so like this?

pulsar arrow
#

interaction_check is a View method

#

not a button

#

you can also run the check in your button's callback whatever you prefer

ivory ivy
#

oh

round sequoia
#

If your issue is fixed please use /close. It is is not you can continue using this thread :)