【发布时间】:2021-04-25 00:18:17
【问题描述】:
我一直试图弄清楚 discord.py 或 python 中是否有一些东西会在命令返回时重置命令的冷却时间。例如(如下所示)有人键入!math,但如果有另一个命令正在运行,该命令将不会继续执行,用户必须再次等待 60 秒,因为该命令处于冷却状态。
代码举例:
@bot.command()
@commands.cooldown(1, 60.00, commands.BucketType.guild)
async def math(msg):
if msg.channel.id != channel:
return
if another_command_running:
await msg.send(msg.author.mention + " Another command is running")
return
....
....
....
【问题讨论】: