Dropdown menus dont work with if statements
Summary
There is an "unknown webhook" error when i try to use a dropdown.
Reproduction Steps
Subclass discord.ui.View and make a dropdown menu. Then make 5 options and assign a value to each of them. Then, make if statements to edit the original message when the user reacts to a particular option. in my case, i had made only 2, because i was only testing. Then, run the command and react with an option(i reacted to the first one, since it had an if statement.
Minimal Reproducible Code
class HelpView(discord.ui.View):
@discord.ui.select(placeholder = 'Select A Command Category Here', min_values = 1, max_values = 1, options = [
discord.SelectOption(label = 'Moderation', description = "Shows Info About All the moderation commands.", emoji = '🔨', value= 'moderation'),
discord.SelectOption(label = 'Administration', description = "Shows all the admin commands. Not A Lot of stuff here.", emoji = '⚙️', value = 'admin'),
discord.SelectOption(label = 'Information', description = "Shows All the Info Commands", emoji = '❓' , value = 'info'),
discord.SelectOption(label = 'Fun', description = "Shows All the Fun Commands", emoji = '🎠', value= 'fun'),
discord.SelectOption(label = "Misc", description = "Shows the Misc Commands", emoji = '🎭', value='misc')
])
async def select_callback(self, select: discord.ui.Select, interaction: discord.Interaction):
if select.values[0] == 'moderation':
await interaction.edit_original_message(content = 'mod help test opt1')
elif select.values[0] == 'admin':
await interaction.edit_original_message(content ='admin help test opt2')
Expected Results
expected result is for it to edit the message with the given options.
Actual Results
I get this error, even though im not using ANY webhooks. neither in the channel, nor in the code:
Ignoring exception in view
Intents
intents = discord.Intents.all()
System Information
- Python v3.9.6-final
- py-cord v2.0.0-alpha
- py-cord pkg_resources: v2.0.0a4148+g2bbf0639
- aiohttp v3.7.4.post0
- system info: Windows 10 10.0.22494
Checklist
- [X] I have searched the open issues for duplicates.
- [X] I have shown the entire traceback, if possible.
- [X] I have removed my token from display, if visible.
Additional Context
No response
Any idea on how to fix this? Its been 2 days
Discord uses webhooks internally. So it's correct.
Any idea on how to fix this? Its been 2 days
I think you can use interaction.response.edit_message instead.
Yes you can use interaction.response.edit_message instead as @MhmCats told
i believe it said that wasnt a method in interaction, but i'll try it