我有下面的Pycord命令
@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)当运行“title”设置为"test“的斜杠命令时,我会看到机器人的响应"hi”。但是,当我使用另一个标题(这会导致嵌入)时,bot会使用错误的“无效交互应用程序命令”进行响应。
是否可以通过嵌入来响应斜杠命令?
发布于 2022-03-07 04:41:00
Im不能100%确定这是否是答案,但问题似乎是,我实际上有两个机器人使用相同的“令牌”和斜杠命令运行。自从我意识到并关闭了复制的机器人之后,这似乎就把事情搞砸了,一切都如预期的那样工作。
也许这是斜杠命令的一个缺点,只有一个bot运行才能真正处理它。
https://stackoverflow.com/questions/71374840
复制相似问题