Discord.py交互斜杠命令冷却



我正在制作一个彩票机器人,其中一个功能是每2小时只让人们玩一次彩票。为了实现这一点,我使用app_commands.checks.cooldown:冷却文档

这一切都如预期的那样工作,但在某些情况下,我想跳过冷却过程,但似乎无法重置它。这是我的片段。

@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

我已经看了文件,我找不到一个方法来消除冷却。我想这和lambda有关。

谢谢你的帮助!

Discord.py 开发团队

"目前没有办法重置冷却时间如果你想重置它,你必须自己进行冷却检查;

最新更新