From d4fdb5611507a1f48d0036375c178f3498ef20d0 Mon Sep 17 00:00:00 2001 From: WubzyGD Date: Sat, 13 Mar 2021 16:09:58 -0700 Subject: [PATCH] add uptime cmd --- commands/fun/spotify.js | 20 -------------------- commands/misc/uptime.js | 29 +++++++++++++++++++++++++++++ package-lock.json | 15 +++++++++++++++ package.json | 1 + 4 files changed, 45 insertions(+), 20 deletions(-) delete mode 100644 commands/fun/spotify.js create mode 100644 commands/misc/uptime.js diff --git a/commands/fun/spotify.js b/commands/fun/spotify.js deleted file mode 100644 index 1ba82f4..0000000 --- a/commands/fun/spotify.js +++ /dev/null @@ -1,20 +0,0 @@ -const Discord = require('discord.js'); -const spotify = require('swwrap'); - -module.exports = { - name: "", - aliases: [], - meta: { - category: '', - description: "", - syntax: '` <>`', - extra: null - }, - help: new Discord.MessageEmbed() - .setTitle("Help -> ") - .setDescription("") - .addField("Syntax", "``"), - async execute(message, msg, args, cmd, prefix, mention, client) { - if (!args.length) {return message.channel.send(`Syntax: \`${prefix}\``);} - } -}; \ No newline at end of file diff --git a/commands/misc/uptime.js b/commands/misc/uptime.js new file mode 100644 index 0000000..63e8b7c --- /dev/null +++ b/commands/misc/uptime.js @@ -0,0 +1,29 @@ +const Discord = require('discord.js'); + +const Bot = require('../../models/bot'); + +const moment = require('moment'); +require('moment-precise-range-plugin'); + +module.exports = { + name: "uptime", + aliases: ['ut', 'up'], + meta: { + category: 'Misc', + description: "Shows the bot's uptime", + syntax: '`uptime`', + extra: null + }, + help: "Shows my uptime, which is how long it's been since my last restart.", + async execute(message, msg, args, cmd, prefix, mention, client) { + const bot = await Bot.findOne({finder: 'lel'}); + return message.channel.send(new Discord.MessageEmbed() + .setTitle("Uptime") + .setThumbnail(client.user.avatarURL({size: 2048})) + .setDescription(moment.preciseDiff(moment(bot.lastRestart), moment())) + .setColor('c375f0') + .setFooter("Natsuki") + .setTimestamp() + ) + } +}; \ No newline at end of file diff --git a/package-lock.json b/package-lock.json index 1550dbc..48ae498 100644 --- a/package-lock.json +++ b/package-lock.json @@ -15,6 +15,7 @@ "discord.js": "^12.2.0", "manyitems": "^1.0.2", "moment": "^2.28.0", + "moment-precise-range-plugin": "^1.3.0", "mongoose": "^5.10.3", "node-fetch": "^2.6.1", "ora": "^5.3.0", @@ -823,6 +824,14 @@ "node": "*" } }, + "node_modules/moment-precise-range-plugin": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/moment-precise-range-plugin/-/moment-precise-range-plugin-1.3.0.tgz", + "integrity": "sha1-YKwHX9/RRon20QKvdR0XGoC0q2A=", + "peerDependencies": { + "moment": ">=2.9.0" + } + }, "node_modules/mongodb": { "version": "3.6.4", "resolved": "https://registry.npmjs.org/mongodb/-/mongodb-3.6.4.tgz", @@ -2266,6 +2275,12 @@ "resolved": "https://registry.npmjs.org/moment/-/moment-2.29.1.tgz", "integrity": "sha512-kHmoybcPV8Sqy59DwNDY3Jefr64lK/by/da0ViFcuA4DH0vQg5Q6Ze5VimxkfQNSC+Mls/Kx53s7TjP1RhFEDQ==" }, + "moment-precise-range-plugin": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/moment-precise-range-plugin/-/moment-precise-range-plugin-1.3.0.tgz", + "integrity": "sha1-YKwHX9/RRon20QKvdR0XGoC0q2A=", + "requires": {} + }, "mongodb": { "version": "3.6.4", "resolved": "https://registry.npmjs.org/mongodb/-/mongodb-3.6.4.tgz", diff --git a/package.json b/package.json index f320ae8..a1230db 100644 --- a/package.json +++ b/package.json @@ -12,6 +12,7 @@ "discord.js": "^12.2.0", "manyitems": "^1.0.2", "moment": "^2.28.0", + "moment-precise-range-plugin": "^1.3.0", "mongoose": "^5.10.3", "node-fetch": "^2.6.1", "ora": "^5.3.0",