How to edit a message in discord.py

前端 未结 2 1357
感情败类
感情败类 2021-01-14 00:53

I would like to have my bot edit a message if it detects a keyword, i\'m not sure how to edit the message though.

I\'ve looked through the documentation but can\'t s

相关标签:
2条回答
  • 2021-01-14 01:34

    Here's a solution that worked for me.

    @client.command()
    async def test(ctx):
      message = await ctx.send("hello")
      await asyncio.sleep(1)
      await message.edit(content="newcontent")
    
    0 讨论(0)
  • 2021-01-14 01:43

    You can use the Message.edit coroutine. The arguments must be passed as keyword arguments content, embed, or delete_after. You may only edit messages that you have sent.

    await message.edit(content="newcontent")
    
    0 讨论(0)
提交回复
热议问题