【发布时间】:2020-08-16 14:07:50
【问题描述】:
有没有办法让机器人编辑自己的消息?我试图寻找答案,但找不到答案。
【问题讨论】:
标签: python discord.py
有没有办法让机器人编辑自己的消息?我试图寻找答案,但找不到答案。
【问题讨论】:
标签: python discord.py
这将通过代码完成。您需要以某种方式在您的机器人程序中执行它。例如,为它创建一个执行它的命令,然后你可以删除它。
channel = bot.get_channel(id_of_the_channel)
message = await channel.fetch_message(id_of_the_message)
# make sure that you change "id_of_the_channel" for the id of the channel (as an integer)
# and make sure to change "id_of_the_message" for the id of the message (as an integer)
# you can get those by enabling Developer Mode in the Appearance settings in discord
# and right-clicking on the channel to get its id, and right-clicking on the message to get
# its id as well.
await message.edit(content="the new content of the message")
基本上就是这样。通过你的机器人执行这三行代码,它会编辑消息。
【讨论】: