pycord icon indicating copy to clipboard operation
pycord copied to clipboard

Button Interaction failing when sending View with an Embed.

Open yagomichalak opened this issue 5 years ago • 0 comments

Summary

Whenever you send a view with an embed, the button callbacks of that same view won't fire.

Reproduction Steps

  • Create a simple command that sends a message;
  • Make a simple embed and view to send;
  • Send them together;
  • Observe.

Minimal Reproducible Code

@client.command()
async def test(ctx):

    class MyView(discord.ui.View):

        def __init__(self, *, timeout: Optional[float]):
            super().__init__(timeout=timeout)

        @discord.ui.button(label="test", custom_id="test_id", style=discord.ButtonStyle.blurple)
        async def test_button(self, button: discord.ui.button, interaction: discord.Interaction):
            await interaction.response.send_message('tested')

    embed = discord.Embed(description="Test embed")
    await ctx.send(embed=embed, view=MyView(timeout=60))

Expected Results

The callbacks should get triggered when you click on their respective buttons.

Actual Results

They don't trigger, and the interaction fails.

Intents

All intents

System Information

  • Python v3.9.6-final
  • discord.py v2.0.0-alpha
    • discord.py pkg_resources: v2.0.0a3453+g58ca9e99
  • aiohttp v3.7.4.post0
  • system info: Windows 10 10.0.19042

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

yagomichalak avatar Sep 15 '21 16:09 yagomichalak