Reset_cooldown Discord.py

ParrotSec03

私は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')```
好意1
@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]

編集
0

コメントを追加

0

関連記事