我对discord.py 和Python 都很陌生,但我正在努力学习。我不知道如何将 command.reset_cooldown 添加到我的代码中。正如下面代码中所说,我希望 !test 忽略冷却时间,但我希望 !test 2 有冷却时间。有人能帮我吗?
@commands.cooldown(1, 30, commands.BucketType.user)
async def test(ctx, command=None):
if command is None:
await ctx.send('I want this to ignore cooldown')
elif command.lower() == '2':
await ctx.send('I want this to have a Cooldown')```
@commands.cooldown(1, 30, commands.BucketType.user)
async def test(ctx, command=None):
if command is None:
await ctx.send('I want this to ignore cooldown')
test.reset_cooldown(ctx)
elif command.lower() == '2':
await ctx.send('I want this to have a Cooldown')
本质上,正是上面那个人所说的,但没有await
。尝试了他的代码,但它不起作用,幸运的是我能够找到为我指明正确方向的资源。
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)