'Pycord Slash command Respond with Embed
I have the following Pycord slash command
@commands.slash_command(name="testcmd")
@commands.has_permissions(administrator=True)
async def SampleSlashComand(self, ctx: commands.Context,
title: Option(str, "title", required=True),
description: Option(str, "description", required=True),
):
await ctx.defer()
if title == "test":
return await ctx.respond("hi")
embed = discord.Embed(
title=f"{title}",
description=f"{description}",
timestamp=datetime.now()
)
return await ctx.respond(embed=embed)
When running the slash command with 'title' set to "test", I see the respone "hi" from the bot. However when I use another title, which causes an embedding to be posted, the bot responds with the error "Invalid interaction application command"
Is it possible to have a slash command be responded with a embedding?
Solution 1:[1]
Im not 100% sure if this is the answer or not but it appears the issue was that I actually had 2 bots running with the same "token" and slash command. This seems to have messed something up since when I realized and shutdown the duplicate bot everything worked as expected.
Maybe this is the one downside to slash commands, only one bot running can really handle it
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | lufthansa747 |
