discord.py:如何在嵌入方式中显示如Discord消息时间戳中所示的日期?

发布于 2025-01-29 05:48:10 字数 375 浏览 3 评论 0原文

我想复制以下时间的表示:我想重新创建的东西

我已经拥有的东西:< a href =“ https://i.sstatic.net/bdth9.png” rel =“ nofollow noreferrer”>我拥有的

代码:

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

如何重新创建它?

I want to replicate this representation of time: What I Want To Recreate

What I already have: What I Have

Code:

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

How can I recreate it?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

り繁华旳梦境 2025-02-05 05:48:10

因此,Discord使用Epoch值来获得时间,并获得格式为&lt; t:{epoch value}:{mode}&gt;。要获得时期值,有一个函数知道为timestamp()

因此,我们的新代码将是:

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

So, discord uses epoch value to get time and the format to get it is <t:{epoch value}:{mode}>. To get the epoch value there is a function know as timestamp().

So our new code will be :

created = ctx.guild.created_at.timestamp()
embed.add_field(name ="created at:", value=f"<t:{created}:R>",......) 
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文