我有一个斜杠命令,但处理需要几秒钟。由于Discord响应交互的限制似乎是3秒,我在文档中找到了interaction.response.defer ()方法,这应该告诉Discord我已经收到了命令(不要抛出错误“交互没有响应” ”)
@client.slash_command(description="Test command", guild_ids=[123456789123456789])
async def test(interaction: nextcord.Interaction):
await interaction.response.defer()
await asyncio.sleep(10) # Doing stuff
await interaction.response.send_message("My actual content")
Run Code Online (Sandbox Code Playgroud)
但我收到这个错误:
nextcord.errors.InteractionResponded: This interaction has already been responded to before
Run Code Online (Sandbox Code Playgroud)
我究竟做错了什么 ?
| 归档时间: |
|
| 查看次数: |
19712 次 |
| 最近记录: |