def __init__(self, user):
super().__init__()
self.user = user
@discord.ui.button(label="Close", style=discord.ButtonStyle.red, emoji="❌")
async def close_button(self, interaction: discord.Interaction, button: discord.ui.Button):
await interaction.message.delete()
@discord.ui.button(label="Add Link", style=discord.ButtonStyle.green, emoji="🔗")
async def add_link_button(self, interaction: discord.Interaction, button: discord.ui.Button):
# Send a message to the user to enter a link
await interaction.response.send_message(content="Please send the link you want to add.", ephemeral=True)```
I looked over this code multiple times, but I just keep getting
await interaction.response.send_message(content="Please send the link you want to add.", ephemeral=True)
^^^^^^^^^^^^^^^^^^^^
AttributeError: 'Button' object has no attribute 'response'
#AttributeError: 'Button' object has no attribute 'response'
1 messages · Page 1 of 1 (latest)
you need to put the button parameter before the interaction parameter
that's how it's passed to the button callback
should be (self, button: discord.ui.Button, interaction: discord.Interaction) and not (self, interaction: discord.Interaction , button: discord.ui.Button).
its what the toothy said (i repeat it cos i didnt find that really clear)
(button before interaction in the placement)
thanks for (wrongly) repeating what I just said
if they don't find that clear they can tell me themselves
What part is wrong?