Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

AttributeError: 'Button' object has no attribute 'response'

class MyView(View):  
    @discord.ui.button(label = 'Ping🏓',style=discord.ButtonStyle.red)
    async def ping_button_callback(self, button, interaction):
        await interaction.response.send_message(embed = pingembed)

It was working fine, until today when I tryed to execute the command and it gave me that error

AttributeError: 'Button' object has no attribute 'response'

Before, he sent the message like this:

Ping Command🏓! This command will show the ping of the bot For example:

.ping Pong!🏓 139 ms

like image 801
ySunsh Avatar asked Sep 21 '26 05:09

ySunsh


1 Answers

You swapped the arguments. The first argument (in this case button) is the Interaction instance. The second one (in this case interaction) is the Button instance

like image 146
Kejax Avatar answered Sep 22 '26 18:09

Kejax