Discord.py延迟发送时间



我想知道有了这个延迟字符串代码,是否可以向用户发送消息,告诉他们要等待多长时间?

@commands.cooling(速率=1,每个=5,类型=commands.BucketType.user(

是的,我们可以像我下面所做的那样发送关于冷却剩余时间的消息:

@command_name.error
async def command_error(ctx, error):
if isinstance(error, commands.CommandOnCooldown):
em = discord.Embed(title=f"command is on cooldown",description=f"Try again in {error.retry_after:.2f}s.", color=0xFFFF00)
await ctx.send(embed=em) 

相关内容

最新更新