私はdiscord.pyとPython全般にかなり慣れていませんが、学ぼうとしています。command.reset_cooldownをコードに追加する方法がわかりません。以下のコードにあるように、!testにクールダウンを無視させたいのですが、!test2にクールダウンを持たせたいのです。誰かが私を助けることができますか?
@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
。彼のコードを試してみましたが、うまくいきませんでした。幸運なことに、正しい方向を示しているソースを見つけることができました。
この記事はインターネットから収集されたものであり、転載の際にはソースを示してください。
侵害の場合は、連絡してください[email protected]
コメントを追加