Discord.py:如何在嵌入中显示日期,如不和谐消息时间戳中所示?

Discord.py: how to show dates in an embed like shown in discord message timestamps?

我想复制这种时间表示:What I Want To Recreate

我已经拥有的:What I Have

代码:

created = ctx.guild.created_at
embed.add_field(name = f"Created:", value = f"{created}", inline=False)

我怎样才能重新创建它?

因此,discord使用epoch值获取时间,获取格式为<t:{epoch value}:{mode}>。要获得纪元值,有一个称为 timestamp().

的函数

所以我们的新代码将是:

created = ctx.guild.created_at.timestamp()
embed.add_field(name ="created at:", value=f"<t:{created}:R>",......)