@client.event
async def on_command_error(ctx,error)。
if isinstance(error , commands.CommandOnCooldown):
await ctx.send(f'{ctx.author.tion}**hold your horses buddy <:iac_namaste:841266597318361098>**')
await ctx.send('Try again in {:2f}s'.format(error.retry_after))
我在我的一個命令上添加了20分鐘的冷卻時間
并且作業正常,但我沒有得到最小或小時格式的輸出
我希望它能發送類似20分鐘后再試的資訊,并顯示還剩多少分鐘
我希望它能發送類似20分鐘后再試的資訊。
uj5u.com熱心網友回復:
最好的方法是直接使用新的discord時間戳格式
import time # Add this to the top
# 然后在錯誤處理程式中。
await ctx.send('Try again in <t:{}:R>'.format(int)(time.time() error.retry_after))
轉載請註明出處,本文鏈接:https://www.uj5u.com/qukuanlian/311645.html
標籤:
下一篇:在JSON物件中追加串列
