Home > Software design >  Disabling nextcord button
Disabling nextcord button

Time:08-24

As title says, I'm trying to find a way how to disable the button for the person, who already interacted with it.

Like when it reaches 5 interactions, it turns green. I had checked the GitHub official Nextcord repository and found the counter.py file, which includes the changing button color after the number of interactions. But I still need to find a way how to disable it for user who already interacted. Thanks for any help!

CodePudding user response:

Simply set the disabled property to True and edit the message with the new view.

If using the decorator in a View class it would look like this

button.disabled = True
await interaction.response.edit_message(view=self)
  • Related