Do0ks
Do0ks

Reputation: 39

Discord.py interaction slash command cooldowns

I'm making a lottery bot and one of the functions is to only let people play the lottery once every 2 hours. To achieve this, I'm using app_commands.checks.cooldown : cool down documentation

It all works as expected however there is certain circumstances where I would like to skip over the cool down and I can't seem to reset it. here's my snippet.

@app_commands.checks.cooldown(1, 7200, key=lambda i: (i.guild_id, i.user.id))
@tree.command(guild=discord.Object(id=1002036221725388900), name="test", description="testing")
    async def test(interaction: discord.Interaction):
    lotterychannel = bot.get_channel(1002055003491545099)
    if interaction.channel.id != 1002055003491545099:
        embed = discord.Embed(title="**Ops!!**", description=f"The lottery can only be played in <#1002696404046712932>!", color=0x00ff00)
        await interaction.response.send_message(embed=embed)
        test.remove_check() #place remove cool down here
    else:
        #other code

I have looked through the documentation and I cant find a way to remove the cool down. I would guess it has something to do with lambda.

Thanks for any help!

Upvotes: 1

Views: 2792

Answers (1)

Do0ks
Do0ks

Reputation: 39

From the Development team of Discord.py

"there currently isn't a way to reset the cooldown you would have to make your own cooldown check if you want to reset it"

Upvotes: 2

Related Questions