【发布时间】:2021-05-10 18:25:38
【问题描述】:
好的,我正在 python 中制作货币机器人。我对python很流利(只是没有用过那么多协程)
我想要实现的是,如果用户在前 20 秒内发送了消息,机器人不会响应用户。 time.sleep 在这里不起作用,因为它会阻止所有代码(其他用户应该得到回复)。我只是不知道该怎么做。
async def on_message(message):
if message.author==client.user:
return
await make_bank(message.author.id)
if message.content=="A":
await message.channel.send("Done! Wait 20 secs.")
【问题讨论】:
-
请添加您的代码,也可以使用
time.sleep代替asyncio.sleep -
我的代码中有这个。让我添加它
标签: python python-3.x discord discord.py