如何编辑后续消息(discord.py)?



我有这个代码,但是我不明白如何可以编辑后续消息。谢谢!

@bot.command()
async def button(ctx):
view=View()
button_create = Button(label="CREATE", style=discord.ButtonStyle.green)
view.add_item(button_create)
await ctx.send(view=view)
async def button_callback(interaction):
await interaction.response.defer()
await asyncio.sleep(delay=1)
await interaction.followup.send("Hi", ephemeral=True) # How can i edit this message? -_-
button_create.callback = button_callback

我尝试使用"interaction.follow .edit_message("Something")",但我得到错误:

discord.errors。HTTPException: 400 Bad Request (error code: 50035): Invalid Form Body在message_id中:Value "Something"不是雪花

followup.send()返回它发送的WebhookMessage对象如果您将waitkwarg设置为True,因此您可以将其存储在一个变量中,并对其调用.edit()

Fromsenddocs:

wait (bool) -服务器在发送响应之前是否应该等待。这实际上意味着如果设置为True,则该函数的返回类型从None变为WebhookMessage。.

最新更新