[英]How to edit message discord.py
我正在嘗試編輯消息:
chat = client.get_channel(1007301750895677491)
msg = client.fetch_message(1007556250134917170)
await msg.edit(content=discord.File('week_result.png'))
但我收到錯誤:
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'
您不能將content
傳遞給圖像(閱讀文檔) ...
(PS)為了發送圖像並稍后編輯它,您必須使用嵌入消息......然后您將能夠傳遞message.edit
另一個參數(即嵌入),這將允許您這樣做。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.