【发布时间】:2023-04-02 22:19:01
【问题描述】:
如果我的机器人检测到关键字,我想让它编辑消息,但我不确定如何编辑消息。
我查看了文档,但似乎无法弄清楚。我在 python 3.6 中使用 discord.py。
这是代码:
@bot.event
async def on_message(message):
if 'test' in message.content:
await edit(message, "testtest")
这是错误:
File "testthing.py", line 67, in on_message
await edit(message, "test")
NameError: name 'edit' is not defined
如果消息包含单词 test,我希望机器人将消息编辑为“testtest”,但我只是收到一个错误。
【问题讨论】:
-
您使用的是什么版本的 discord.py?
print(discord.__version__) -
Discord.py 1.0.0
标签: python discord.py