'discord-components lib, need to send custom error message

so i basically need a custom error message for this:

@bot.command()
async def test(ctx):
  embed = discord.Embed(title="test", description="test 2")
  msg = await ctx.send(embed=embed, components=[[Button(style=ButtonStyle.green, label="test1"), Button(style=ButtonStyle.blue, label="test2")]])
  while True:
      res = await bot.wait_for("button_click", check=lambda inter: inter.user == ctx.author)    
      if res.component.label == "test1":
        embed2 = discord.Embed(title="asd2yk",  description="asd2yk")
        await res.respond(type=7, embed=embed2)
        pass
      elif res.component.label == "test2":
        embed = discord.Embed(title="asd",description="asd")
        await res.respond(type=4, content="Hello",ephemeral=True)
        pass

I just need to send a message, instead of it saying "Interaction failed" i already managed it to make it only work for the message author. I'm not sure how to send a message instead of it saying "interaction failed" tho, and that's my issue.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source