[英]Edit a message in a specific channel in Discord.py
(不和谐.py)
我正在尝试在专用频道中制作“状态”消息,此消息将受到其他频道中发送的消息的影响为此我需要 select 我在所述频道中的消息,然后对其进行编辑
我已经环顾四周并尝试了大约一个小时,但我找不到任何有用的东西,我得到的最接近的是:
status_msg = "Placeholder"
status_channel = client.get_channel(channelID)
status_message = status_channel.fetch_message(messageID)
await status_message.edit(content=status_msg)
出现错误: AttributeError: 'coroutine' object has no attribute 'edit'
我相信我需要不同的编辑命令?
(我正在使用@client.event
,这需要在async def on_message(message):
中发生:)
您需要根据文档await
fetch_message
function 。
status_msg = "Placeholder"
status_channel = client.get_channel(channelID)
status_message = await status_channel.fetch_message(messageID)
await status_message.edit(content=status_msg)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.