remove moment dependency
This commit is contained in:
parent
1b93be6599
commit
4001080638
5 changed files with 40 additions and 28 deletions
|
@ -1,5 +1,4 @@
|
||||||
const { Client, CommandInteraction, EmbedBuilder } = require("discord.js");
|
const { Client, CommandInteraction, EmbedBuilder } = require("discord.js");
|
||||||
const moment = require("moment");
|
|
||||||
const axios = require("axios");
|
const axios = require("axios");
|
||||||
module.exports = {
|
module.exports = {
|
||||||
name: "build",
|
name: "build",
|
||||||
|
@ -663,7 +662,7 @@ module.exports = {
|
||||||
* @param {CommandInteraction} interaction
|
* @param {CommandInteraction} interaction
|
||||||
* @param {String[]} args
|
* @param {String[]} args
|
||||||
*/
|
*/
|
||||||
run: async (client, interaction, args) => {
|
run: async (client, interaction, args, utils) => {
|
||||||
const cwts = args[1];
|
const cwts = args[1];
|
||||||
const cc = args[2];
|
const cc = args[2];
|
||||||
const tag = args[3];
|
const tag = args[3];
|
||||||
|
@ -710,8 +709,8 @@ module.exports = {
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "<a:lastupdate:897381474330873887> Last Updated:",
|
name: "<a:lastupdate:897381474330873887> Last Updated:",
|
||||||
value: `\`\`\`\n${moment(Date.parse(data.lastUpdate)).format(
|
value: `\`\`\`\n${utils.parseShortDate(
|
||||||
"MMMM Do YYYY"
|
new Date(data.lastUpdate)
|
||||||
)}\n\`\`\``,
|
)}\n\`\`\``,
|
||||||
inline: true,
|
inline: true,
|
||||||
},
|
},
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
const { EmbedBuilder, version: djsversion } = require("discord.js");
|
const { EmbedBuilder, version: djsversion } = require("discord.js");
|
||||||
const version = require("../../package.json").version;
|
const version = require("../../package.json").version;
|
||||||
const { utc } = require("moment");
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
name: "botinfo",
|
name: "botinfo",
|
||||||
description: "Check the info of the bot",
|
description: "Check the info of the bot",
|
||||||
|
@ -20,8 +19,8 @@ module.exports = {
|
||||||
<:nyx_owner:897418259433943120> Owner ❯ <@452076196419600394>
|
<:nyx_owner:897418259433943120> Owner ❯ <@452076196419600394>
|
||||||
Bot ❯ ${client.user.tag}
|
Bot ❯ ${client.user.tag}
|
||||||
Bot ID ❯ \`${client.user.id}\`
|
Bot ID ❯ \`${client.user.id}\`
|
||||||
Created on ❯ \`${utc(client.user.createdTimestamp).format(
|
Created on ❯ \`${utils.botDate(
|
||||||
"MMMM Do YYYY"
|
new Date(client.user.createdTimestamp)
|
||||||
)}\``,
|
)}\``,
|
||||||
inline: true,
|
inline: true,
|
||||||
},
|
},
|
||||||
|
|
|
@ -41,11 +41,10 @@
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"axios": "^1.1.3",
|
"axios": "^1.1.3",
|
||||||
"cath": "^1.5.0",
|
"cath": "^1.5.11",
|
||||||
"discord.js": "^14.9.0",
|
"discord.js": "^14.9.0",
|
||||||
"dotenv": "^16.0.3",
|
"dotenv": "^16.0.3",
|
||||||
"goosecache": "^9.0.14",
|
"goosecache": "^9.0.14",
|
||||||
"moment": "^2.29.4",
|
|
||||||
"mongoose": "^5.13.14",
|
"mongoose": "^5.13.14",
|
||||||
"quickchart-js": "^3.1.0"
|
"quickchart-js": "^3.1.0"
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,4 @@
|
||||||
const { EmbedBuilder } = require("discord.js");
|
const { EmbedBuilder } = require("discord.js");
|
||||||
const moment = require("moment");
|
|
||||||
const axios = require("axios");
|
const axios = require("axios");
|
||||||
module.exports = {
|
module.exports = {
|
||||||
name: "stats",
|
name: "stats",
|
||||||
|
@ -406,7 +405,7 @@ module.exports = {
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
// It's not complete, Still work in progress.
|
// It's not complete, Still work in progress.
|
||||||
run: async (client, interaction, args) => {
|
run: async (client, interaction, args, utils) => {
|
||||||
const cwts = args[1];
|
const cwts = args[1];
|
||||||
const data = await axios
|
const data = await axios
|
||||||
.get(`${process.env.api}/api/v1/codm/builds?cwts=${cwts}`, {
|
.get(`${process.env.api}/api/v1/codm/builds?cwts=${cwts}`, {
|
||||||
|
@ -444,8 +443,8 @@ module.exports = {
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "<a:lastupdate:897381474330873887> Last Updated:",
|
name: "<a:lastupdate:897381474330873887> Last Updated:",
|
||||||
value: `\`\`\`\n${moment(Date.parse(data.lastUpdate)).format(
|
value: `\`\`\`\n${utils.parseShortDate(
|
||||||
"MMMM Do YYYY"
|
new Date(data.lastUpdate)
|
||||||
)}\n\`\`\``,
|
)}\n\`\`\``,
|
||||||
inline: true,
|
inline: true,
|
||||||
},
|
},
|
||||||
|
|
|
@ -11,28 +11,31 @@ const {
|
||||||
Array.prototype.random = function () {
|
Array.prototype.random = function () {
|
||||||
return this[~~(Math.random() * this.length)];
|
return this[~~(Math.random() * this.length)];
|
||||||
};
|
};
|
||||||
|
|
||||||
function rndint(max, min) {
|
function rndint(max, min) {
|
||||||
return Math.floor(Math.random() * (max - (min ? min : 0))) + (min ? min : 0);
|
return Math.floor(Math.random() * (max - (min ? min : 0))) + (min ? min : 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const months = [
|
||||||
|
"January",
|
||||||
|
"February",
|
||||||
|
"March",
|
||||||
|
"April",
|
||||||
|
"May",
|
||||||
|
"June",
|
||||||
|
"July",
|
||||||
|
"August",
|
||||||
|
"September",
|
||||||
|
"October",
|
||||||
|
"November",
|
||||||
|
"December",
|
||||||
|
];
|
||||||
|
|
||||||
function parseDate(date) {
|
function parseDate(date) {
|
||||||
const months = [
|
|
||||||
"January",
|
|
||||||
"February",
|
|
||||||
"March",
|
|
||||||
"April",
|
|
||||||
"May",
|
|
||||||
"June",
|
|
||||||
"July",
|
|
||||||
"August",
|
|
||||||
"September",
|
|
||||||
"October",
|
|
||||||
"November",
|
|
||||||
"December",
|
|
||||||
];
|
|
||||||
let dow = date.getDate().toString();
|
let dow = date.getDate().toString();
|
||||||
return `${date.toLocaleDateString("en-US", {
|
return `${date.toLocaleDateString("en-US", {
|
||||||
weekday: "long",
|
weekday: "long",
|
||||||
})}, ${months[date.getMonth() - 1]} ${
|
})}, ${months[date.getMonth()]} ${
|
||||||
dow.endsWith("1")
|
dow.endsWith("1")
|
||||||
? `${dow}st`
|
? `${dow}st`
|
||||||
: dow.endsWith("2")
|
: dow.endsWith("2")
|
||||||
|
@ -43,6 +46,18 @@ function parseDate(date) {
|
||||||
} ${date.getFullYear()}, ${date.toLocaleTimeString()}`;
|
} ${date.getFullYear()}, ${date.toLocaleTimeString()}`;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function parseShortDate(date) {
|
||||||
|
let dow = date.getDate().toString();
|
||||||
|
return `${months[date.getMonth()]} ${
|
||||||
|
dow.endsWith("1")
|
||||||
|
? `${dow}st`
|
||||||
|
: dow.endsWith("2")
|
||||||
|
? `${dow}nd`
|
||||||
|
: dow.endsWith("3")
|
||||||
|
? `${dow}rd`
|
||||||
|
: `${dow}th`
|
||||||
|
} ${date.getFullYear()}`;
|
||||||
|
}
|
||||||
function timer(timestamp) {
|
function timer(timestamp) {
|
||||||
const timeLeft = timestamp;
|
const timeLeft = timestamp;
|
||||||
const days = Math.floor(timeLeft / 86400000);
|
const days = Math.floor(timeLeft / 86400000);
|
||||||
|
@ -794,6 +809,7 @@ function convert(value, unit, unitValues) {
|
||||||
module.exports = {
|
module.exports = {
|
||||||
rndint,
|
rndint,
|
||||||
parseDate,
|
parseDate,
|
||||||
|
parseShortDate,
|
||||||
timer,
|
timer,
|
||||||
sleep,
|
sleep,
|
||||||
toHHMMSS,
|
toHHMMSS,
|
||||||
|
|
Loading…
Reference in a new issue