简体   繁体   English

如何编辑消息 discord.py

[英]How to edit message discord.py

I am trying to edit message:我正在尝试编辑消息:

chat = client.get_channel(1007301750895677491)
msg = client.fetch_message(1007556250134917170)
await msg.edit(content=discord.File('week_result.png'))

But I am getting error:但我收到错误:

Task exception was never retrieved
future: <Task finished name='Task-14' coro=<week_vipe() done, defined at main.py:80> exception=AttributeError("'coroutine' object has no attribute 'edit'")>
Traceback (most recent call last):
  File "main.py", line 164, in week_vipe
    await msg.edit(content=discord.File('week_result.png'))
AttributeError: 'coroutine' object has no attribute 'edit'

You can't pass content an image (read docs) ...您不能将content传递给图像(阅读文档) ...

(PS) In order to send an image and edit it later on you'll have to use embed messages... and then you'll be able to pass message.edit another argument (which is the embed) which will allow you to do so. (PS)为了发送图像并稍后编辑它,您必须使用嵌入消息......然后您将能够传递message.edit另一个参数(即嵌入),这将允许您这样做。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM