const moment = require('moment');
moment.utc(<Message>.member.joinedAt).format('YYYY-MM-DD');
完整示例:
const Discord = require('discord.js'); // Define Discord
const client = new Discord.Client(); // Define client
const moment = require('moment'); // Define moment
let prefix = 'your-prefix'; // Define your bots prefix
client.on('message', function(message) { // Message event listener
if (message.content.startsWith(`${prefix}info`)) { // If the message starts with the command
message.channel.send(`<@!${message.author.id}>, you joined this server on ${moment.utc(message.member.joinedAt).format('YYYY-MM-DD')}`);
}
});
1条答案
按热度按时间m4pnthwp1#
您可以使用名为矩的包。
例子:
完整示例: