【发布时间】:2020-11-04 04:44:42
【问题描述】:
所以,目前我正在尝试进行冷却,以小时和分钟为单位显示剩余时间。我计算了分钟和秒,但我很难过几个小时。这是我的代码
@commands.command(aliases=["claim"])
@commands.cooldown(1, 86400, commands.BucketType.user)
(some code here)
@daily.error
async def daily_error(self, ctx, error):
if isinstance(error, commands.CommandOnCooldown):
embed = discord.Embed(
title="You're on a cooldown!", color=discord.Color.blue())
cd = round(error.retry_after)
hours = str(cd // 3600)
minutes = str(cd % 60)
embed.add_field(
name="\u200b",
value=
f"Slow down will ya?\n Wait for `{self.leadingZero(hours)}hours{self.leadingZero(minutes)}minutes`"
)
await ctx.send(embed=embed)
【问题讨论】:
标签: discord.py