Interaction failed for simple selector UI #9926
-
Below is a very simple selector implementation that is based on the sample dropdown.py in the repo. If I select any item in the dropdown, all I get is a error message in the Discord App that 'This interaction failed.` but I'm not sure why. Print debugging shows that the callback is never being called. As a general question: What is the best way to go about debugging something like this? Any help is appreciated. class MySelector(discord.ui.Select):
def __init__(self):
options = [
discord.SelectOption(label='One'),
discord.SelectOption(label='Two'),
discord.SelectOption(label='Three'),
]
super().__init__(placeholder="Select an option", min_values=1, max_values=1, options=options)
async def callback(self, interaction: discord.Interaction):
print('callback handler')
await interaction.response.edit_message(content=f'You selected: {self.values[0]}')
class MyView(discord.ui.View):
def __init__(self):
super().__init__()
self.add_item(MySelector())
class TestCog(commands.Cog):
def __init__(self, bot):
self.bot = bot
@commands.command()
async def select(self, ctx):
print('command handler')
view = MyView()
await ctx.send('Select an option', view=view) This sample is dealing with a cog, but that cog is installed in the bot using |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 9 replies
-
Can you please fix your attempted codeblocks... they should be like: |
Beta Was this translation helpful? Give feedback.
-
The code as-is should work fine. However, by default the library only listens to components that are live during the bot's execution. So if these dropdowns are older than your startup the bot is unaware of them. If this is the case you need to use either |
Beta Was this translation helpful? Give feedback.
doh.