javascript - 如何在 discord.js 中访问日期和时间

标签 javascript node.js discord.js

关闭。这个问题需要details or clarity .它目前不接受答案。












想改进这个问题?通过 editing this post 添加详细信息并澄清问题.


去年关闭。







Improve this question




3vilBot
请参阅此不和谐机器人显示消息作为嵌入页脚发送的时间的图像。就像第二天它从今天变成昨天一样,我该怎么做?
我想做基本上相同的使用时间作为页脚。
请帮我

最佳答案

所以 Discord.js 的 MessageEmbed 中有一个方法类,它被称为 .setTimestamp() ..setTimestamp允许您在嵌入页脚上添加时间戳。这是一个例子:

const {
    MessageEmbed
} = require('discord.js');

const exampleEmbed = new MessageEmbed()
    .setTitle("Example")
    .setTimestamp(); // This is what you need!
阅读更多关于 .setTimestamp这里:https://discord.js.org/#/docs/main/stable/class/MessageEmbed?scrollTo=setTimestamp

关于javascript - 如何在 discord.js 中访问日期和时间,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/65964732/

相关文章:

javascript - 如何使用 jQuery 获取 url 参数值并将其传递到 url 中

node.js - 如何修复目录导入 '@angular-devkit\build-angular\src\dev-server' 不支持在将 Angular 更新到版本 13 后解析 ES 模块

javascript - 不和谐 : Using a command to get Data from Array

javascript - 编辑不和谐角色权限。 (不和谐.js)

javascript - 使用 npm 离线引导 Web 应用程序

node.js - Discord.js V14 interaction.editReply 给出无效的 webhook token 错误

通过 native 弹出窗口的 javascript 输入

javascript - 检查浏览器的位置是否打开仅一次

javascript - GWT/JavaScript : Get Url Of User-Selected Local File

javascript - Node.js 中未使用 RS256 算法生成 jsonwebtoken token