简体   繁体   中英

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

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM