mirror of
https://github.com/Rapptz/discord.py.git
synced 2025-09-06 09:56:09 +00:00
Change View callback order to (self, interaction, item)
This is more consistent with the rest of the library which always has the interaction as the first parameter. This has been done before in the command extension as well, the first parameter is always either self or the context.
This commit is contained in:
@ -27,14 +27,14 @@ class Confirm(discord.ui.View):
|
||||
# stop the View from listening to more input.
|
||||
# We also send the user an ephemeral message that we're confirming their choice.
|
||||
@discord.ui.button(label='Confirm', style=discord.ButtonStyle.green)
|
||||
async def confirm(self, button: discord.ui.Button, interaction: discord.Interaction):
|
||||
async def confirm(self, interaction: discord.Interaction, button: discord.ui.Button):
|
||||
await interaction.response.send_message('Confirming', ephemeral=True)
|
||||
self.value = True
|
||||
self.stop()
|
||||
|
||||
# This one is similar to the confirmation button except sets the inner value to `False`
|
||||
@discord.ui.button(label='Cancel', style=discord.ButtonStyle.grey)
|
||||
async def cancel(self, button: discord.ui.Button, interaction: discord.Interaction):
|
||||
async def cancel(self, interaction: discord.Interaction, button: discord.ui.Button):
|
||||
await interaction.response.send_message('Cancelling', ephemeral=True)
|
||||
self.value = False
|
||||
self.stop()
|
||||
|
Reference in New Issue
Block a user