Python 如何在';关于消息';event discord.py重写

Python 如何在';关于消息';event discord.py重写,python,discord.py-rewrite,Python,Discord.py Rewrite,我正在尝试使discord机器人具有与其他机器人相同的功能 input()命令,但由于discord.py rewrite没有该命令,我搜索了API并找到了wait\u以查找。但是,当然,它带来了一大堆问题。我在互联网上搜索了这个问题,但大多数答案都在@command.command中,而不是async def on_message(message)中,其他答案并没有真正的帮助。我得到的最远的结果是: def check(m): if m.author.name == message.a

我正在尝试使discord机器人具有与其他机器人相同的功能
input()
命令,但由于discord.py rewrite没有该命令,我搜索了API并找到了
wait\u以查找
。但是,当然,它带来了一大堆问题。我在互联网上搜索了这个问题,但大多数答案都在
@command.command
中,而不是
async def on_message(message)
中,其他答案并没有真正的帮助。我得到的最远的结果是:

def check(m):
    if m.author.name == message.author.name and m.channel.name == message.channel.name:
        return True
    else:
        return False
msg = "404 file not found"
try:
msg = await client.wait_for('message', check=check, timeout=60)
await message.channel.send(msg)
except TimeoutError:
    await message.channel.send("timed out. try again.")
    pass
except Exception as e:
    print(e)
    pass

    ```

首先,您使用同一个变量
msg
处理多个事务。这是一个工作的例子,我可以用你提供的信息

msg=“找不到404文件”
等待消息.channel.send(msg)
def检查(m):
返回m.author==message.author和m.channel==message.channel
尝试:
mesg=等待客户端。等待(“消息”,检查=检查,超时=60)
除TimeoutError外:#这可能引发的唯一错误是asyncio.TimeoutError
return wait message.channel.send(“超时,重试”)
wait message.channel.send(mesg.content)#mesg.content是响应,用它做任何你想做的事情
mesg返回一个对象

希望这有帮助

仅供参考:“404文件未找到”只是msg的占位符。谢谢你的回答!