我正在制作一个有冷却时间的不和谐机器人,并且我正在尝试制作一个事件,当CommandOnCooldown
错误发生时,机器人会告诉他们他们需要等待多长时间。这是我的代码,看起来一切正常,但它不知道 retry_after 是什么意思:
@bot.event
async def on_CommandOnCooldown():
await bot.send_message(ctx.message.channel, 'You are on cooldown. Try again in {:.2f}s'.format(retry_after))
@bot.command(pass_context = True)
@commands.cooldown(1, 30, commands.BucketType.user)
async def getalt(ctx):
msg = ["a list of stuff"]
await bot.send_message(ctx.message.author, random.choice(msg))
await bot.send_message(ctx.message.channel, "Alt Has Been Seen To Your DMs")
await bot.purge_from(ctx.message.channel, limit=2)
await bot.send_message(ctx.message.author, "Please Wait 30 Seconds Before Using This Command Again. If you do not wait the full time then you won't be sent an alt.")
我正在使用来自https://git.radiobrony.fr/MKody/discord.py/commit/cd0de57d13b15f709aaacf78ce611dd87e0784ce的参考资料