pycord icon indicating copy to clipboard operation
pycord copied to clipboard

Interaction failed on embed only messages

Open caffe-ian opened this issue 5 years ago • 16 comments

Summary

Interaction fails when the view message doesnt contains text messages

Reproduction Steps

await ctx.send(embed=embed,view=view) will not work and it will return Interaction failed in Discord. No errors even though I created an error handler.

await ctx.send(content="Test",embed=embed,view=view) this worked for me. Maybe it doesnt work whenever content is None.

Note: The first code above worked for me yesterday on both my bots, but after restarting both of them today it stopped working. I tried reinstalling 2.0 and the bug is still there. Couple days ago someone has the same issue as I did but I forgot who is it.

Minimal Reproducible Code

@bot.command()
async def test(ctx):
  view = class.Confirm(ctx)
  embed = discord.Embed(title="Test",color=color.blurple())
  await ctx.send(embed=embed,view=view)

  await view.wait()

  if view.value is None:
      await ctx.send("Timed out...")
  elif view.value:
      await ctx.send("Confirmed...")
  else:
      await ctx.send("Cancelled...")

Expected Results

Expecting this would work: await ctx.send(embed=embed,view=view)

Actual Results

But it returns interaction failed in Discord without any errors.

Intents

default

System Information

py-cord-2.0.0a3844+g2858bd17

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

caffe-ian avatar Sep 14 '21 04:09 caffe-ian

Same Problem here .Im On the slash branch

Nadeem-05 avatar Sep 14 '21 07:09 Nadeem-05

same problem here :(

DevInfinix avatar Sep 14 '21 14:09 DevInfinix

I have tested this (assuming that the Confirm view is the one from the examples):

@bot.command()
async def test(context):
    view = Confirm()
    embed = discord.Embed(title="Test",color=discord.Color.blurple())
    await context.send(embed=embed,view=view)

    await view.wait()

    if view.value is None:
        await context.send("Timed out...")
    elif view.value:
        await context.send("Confirmed...")
    else:
        await context.send("Cancelled...")

and no error occurred... Could you elaborate on what your code is for your Confirm class and what you are doing to reproduce this.

esmaycat avatar Sep 14 '21 17:09 esmaycat

I have tested this (assuming that the Confirm view is the one from the examples):

@bot.command()
async def test(context):
    view = Confirm()
    embed = discord.Embed(title="Test",color=discord.Color.blurple())
    await context.send(embed=embed,view=view)

    await view.wait()

    if view.value is None:
        await context.send("Timed out...")
    elif view.value:
        await context.send("Confirmed...")
    else:
        await context.send("Cancelled...")

and no error occurred... Could you elaborate on what your code is for your Confirm class and what you are doing to reproduce this.

I tested this a few minutes ago and am also having this issue. The issue you will always get "this interaction failed" whenever you click a button, and eventually view.value will return None after it times out.

Did some testing, it only appears to happen with interaction.response.send_message(), as I can use interaction.response.edit_message() as expected with embeds.

OEUG99 avatar Sep 14 '21 20:09 OEUG99

I have tested this (assuming that the Confirm view is the one from the examples):

@bot.command()
async def test(context):
    view = Confirm()
    embed = discord.Embed(title="Test",color=discord.Color.blurple())
    await context.send(embed=embed,view=view)

    await view.wait()

    if view.value is None:
        await context.send("Timed out...")
    elif view.value:
        await context.send("Confirmed...")
    else:
        await context.send("Cancelled...")

and no error occurred... Could you elaborate on what your code is for your Confirm class and what you are doing to reproduce this.

Code that is not working

This is my Confirm class code
class Confirm(discord.ui.View):
  def __init__(self, ctx, user):
    super().__init__(timeout=20)
    self.ctx= ctx
    self.value = "No response"
    self.user = user

  @discord.ui.button(label="Yes", style=discord.ButtonStyle.green)
  async def yes(self, button: discord.ui.Button, interaction: discord.Interaction):
    self.stop()
    for child in self.children:
      child.disabled = True
    self.value = True
    await interaction.response.edit_message(view=self)
    # await interaction.response.send_message("Confirming", ephemeral=True)

  @discord.ui.button(label="No", style=discord.ButtonStyle.red)
  async def no(self, button: discord.ui.Button, interaction: discord.Interaction):
    self.stop()
    for child in self.children:
      child.disabled = True
    self.value = False
    await interaction.response.edit_message(view=self)
    # await interaction.response.send_message("Cancelling", ephemeral=True)

  async def on_timeout(self):
    self.stop()
    for child in self.children:
      child.disabled = True
    self.value = None
    await self.message.edit(view=self)

  async def interaction_check(self, interaction):
    if interaction.user != self.user:
      await interaction.response.send_message("Its not for you!", ephemeral=True)
      return False
    return True

And this is the my command code

import interactions # My file that stores interaction classes

color = discord.Colour

@bot.command()
async def test2(ctx):

    embed = discord.Embed(title="Testing", color=color.blurple())
    view = interactions.Confirm(ctx, ctx.author)
    view.message = await ctx.send(embed=embed, view=view)

    await view.wait()
    await ctx.send(view.value)

And this is what happened image

Code that is working

The Confirm class is exactly same as the one above, I did not change anything.

I just added a text message to my message with embed and view

import interactions # My file that stores interaction classes

color = discord.Colour

@bot.command()
async def test2(ctx):

    embed = discord.Embed(title="Testing", color=color.blurple())
    view = interactions.Confirm(ctx, ctx.author)
    view.message = await ctx.send("Test", embed=embed, view=view)

    await view.wait()
    await ctx.send(view.value)

Then it works image

caffe-ian avatar Sep 15 '21 01:09 caffe-ian

Same problem :/

codeofandrin avatar Sep 15 '21 18:09 codeofandrin

~~I can't reproduce your error, running the code that you said doesn't work just gave me this output:~~ Sorry it seems I hadn't updated pycord

esmaycat avatar Sep 15 '21 19:09 esmaycat

Can confirm that this is a bug.

CodeWithSwastik avatar Sep 16 '21 01:09 CodeWithSwastik

yep. just happened to me. Any planned patches? just happened recently too...

Mootbing avatar Sep 26 '21 01:09 Mootbing

Can also confirm this issue, it's been acknowledged by one of the devs so lets hope it gets fixed soon :)

UP929312 avatar Oct 02 '21 21:10 UP929312

Yep I've been having the same issue since yesterday. I can also confirm!

qonstellations avatar Oct 03 '21 02:10 qonstellations

Fixed in #270.

Dorukyum avatar Oct 14 '21 13:10 Dorukyum

Still having this problem

Nekidev avatar Jan 30 '22 06:01 Nekidev

its 2023 and i still have this problem

gtxg16 avatar Dec 09 '23 18:12 gtxg16

It's 2023 and I still have depressions

Lulalaby avatar Dec 09 '23 18:12 Lulalaby

its 2023 and i still have this problem

Feel free to make a new issue if you're still experiencing this issue

plun1331 avatar Dec 09 '23 20:12 plun1331