I’m trying to make a serverinfo
command, and I wanted to add Server CreationDate
.
This should give the Date
, Time
and How long ago
.
But the issue is when I use message.guild.createdAt
the output looks like this:
Sat Sep 04 2021 09:44:44 GMT+0000 (Coordinated Universal Time)
It’s too long AND it looks bad, I’m wondering if I can have the output look something like this?
09/04/2021 11:44 (3 months and 10 days ago)
Here is my code:
const { MessageEmbed } = require('discord.js');
module.exports = {
name: 'serverinfo',
category: 'Info',
description: 'Shows info about the server.',
aliases: [],
usage: 'Serverinfo',
userperms: [],
botperms: [],
run: async (client, message, args) => {
if(message.author.bot) return;
let staffcount = message.guild.roles.cache.get(process.env.ROLE_STAFF).members.size;
let botcount = message.guild.roles.cache.get(process.env.ROLE_BOT).members.size;
let membercount = message.guild.memberCount - botcount
let verifiedcount = message.guild.roles.cache.get(process.env.ROLE_MEMBER).members.size - staffcount
const embed = new MessageEmbed()
.setThumbnail(client.user.displayAvatarURL({ dynamic: true, size: 512 }))
.setColor("BLUE")
.setTitle(':desktop: SERVER INFORMATION :desktop:')
.addField('Server Name', '```' + message.guild.name + '```',true)
.addField('Server Owner', '```SirDevinci#1998```',true)
.addField('Server Members ['+ membercount +']', '```' + verifiedcount + ' Verified Members | ' + staffcount + ' Staff Members```',false)
.addField('Server Tier','```' + message.guild.premiumTier + '```',true)
.addField('Server Boosts','```' + message.guild.premiumSubscriptionCount + '```',true)
.addField('Server CreationDate','```' + message.guild.createdAt + '```',false)
message.channel.send(embed);
}
}
thanks.