Reverted the last revert and actually fixed the issues with the timestamp format

This commit is contained in:
Essem 2021-08-01 06:42:42 -05:00
parent ac1ff1e923
commit 65c4dbae6a
No known key found for this signature in database
GPG key ID: 7D497397CC3A2A8C
3 changed files with 4 additions and 4 deletions

View file

@ -26,7 +26,7 @@ class ServerInfoCommand extends Command {
},
{
"name": "🗓 **Created on:**",
"value": new Date(this.message.channel.guild.createdAt).toString()
"value": `<t:${Math.floor(this.message.channel.guild.createdAt / 1000)}:F>`
},
{
"name": "👥 **Users:**",

View file

@ -4,7 +4,7 @@ class SnowflakeCommand extends Command {
async run() {
if (!this.args[0]) return "You need to provide a snowflake ID!";
if (!this.args[0].match(/^<?[@#]?[&!]?\d+>?$/) && this.args[0] < 21154535154122752) return "That's not a valid snowflake!";
return new Date((this.args[0].replaceAll("@", "").replaceAll("#", "").replaceAll("!", "").replaceAll("&", "").replaceAll("<", "").replaceAll(">", "") / 4194304) + 1420070400000).toUTCString();
return `<t:${Math.floor(((this.args[0].replaceAll("@", "").replaceAll("#", "").replaceAll("!", "").replaceAll("&", "").replaceAll("<", "").replaceAll(">", "") / 4194304) + 1420070400000) / 1000)}:F>`;
}
static description = "Converts a Discord snowflake id into a timestamp";

View file

@ -38,11 +38,11 @@ class UserInfoCommand extends Command {
},
{
"name": "🗓️ **Joined Discord on:**",
"value": new Date(user.createdAt).toString()
"value": `<t:${Math.floor(user.createdAt / 1000)}:F>`
},
{
"name": "💬 **Joined this server on:**",
"value": member ? new Date(member.joinedAt).toString() : "N/A"
"value": member ? `<t:${member.joinedAt}:F>` : "N/A"
}
]
}