Replaced raw date text with Discord formatted dates, added flag info to help, added note to cat

This commit is contained in:
Essem 2021-07-23 11:13:43 -05:00
parent ef0e1bcf95
commit 7f0f2fb789
No known key found for this signature in database
GPG key ID: 7D497397CC3A2A8C
8 changed files with 233 additions and 205 deletions

View file

@ -8,6 +8,7 @@ class CatCommand extends Command {
return {
embed: {
color: 16711680,
description: "Cat images are sourced from a subset of the [dm4catbot](https://twitter.com/dm4catbot) database.",
image: {
url: data.headers.get("location")
}

View file

@ -15,11 +15,6 @@ class HelpCommand extends Command {
const command = aliases.has(this.args[0].toLowerCase()) ? collections.aliases.get(this.args[0].toLowerCase()) : this.args[0].toLowerCase();
const info = collections.info.get(command);
const counts = await database.getCounts();
/*const counts = countDB.reduce((acc, val) => {
const [key, value] = val;
acc[key] = value;
return acc;
}, {});*/
const embed = {
"embed": {
"author": {
@ -44,6 +39,16 @@ class HelpCommand extends Command {
}]
}
};
if (info.flags.length !== 0) {
const flagInfo = [];
for (const flag of info.flags) {
flagInfo.push(`\`--${flag.name}${flag.type ? `=[${flag.type}]` : ""}\` - ${flag.description}`);
}
embed.embed.fields.push({
"name": "Flags",
"value": flagInfo.join("\n")
});
}
return embed;
} else {
const pages = [];

View file

@ -26,7 +26,7 @@ class ServerInfoCommand extends Command {
},
{
"name": "🗓 **Created on:**",
"value": new Date(this.message.channel.guild.createdAt).toString()
"value": `<t:${this.message.channel.guild.createdAt}: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:${(this.args[0].replaceAll("@", "").replaceAll("#", "").replaceAll("!", "").replaceAll("&", "").replaceAll("<", "").replaceAll(">", "") / 4194304) + 1420070400000}: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:${user.createdAt}:F>`
},
{
"name": "💬 **Joined this server on:**",
"value": member ? new Date(member.joinedAt).toString() : "N/A"
"value": member ? `<t:${member.joinedAt}:F>` : "N/A"
}
]
}