Final SOLUTION:
class MySelect(discord.ui.Select):
def __init__(self):
# doing some init stuff
super().__init__(placeholder="Choose", min_values=1, max_values=1, options=options)
async def callback(self, interaction: discord.Interaction):
self.disabled = True
await interaction.response.edit_message(view=self.view)
# first time callback behavior
Now the original post:
I have my own discord.ui.Select class, and I would like to disable the functionality of the Select after one selection via the callback. I can manage it like:
class MySelect(discord.ui.Select):
def __init__(self):
# doing some init stuff
super().__init__(placeholder="Choose", min_values=1, max_values=1, options=options)
async def callback(self, interaction: discord.Interaction):
if self.disabled:
# inform user about disabled select
return
self.disabled = True
# first time callback behavior
Yet I wonder myself if there is a smoother way since the Select is still callable after I disable it in the first callback execution. I would have expected to disable the Select and then see a non clickable Select similar to modern HTML forms. But maybe I infer this disabled state kinda wrong?
Is there a way to achieve a non-clickable select or is my solution the common way to achieve a one-time clickable Select?