feat: uptime on stats command

This commit is contained in:
2022-09-20 17:36:02 +02:00
parent f69a51bfdb
commit cd2f54a4a4
3 changed files with 10 additions and 13 deletions

View File

@@ -19,6 +19,7 @@ export default commandModule({
const ramtotal = await axios(`http://192.168.1.44:7271/ramtotal`)
const ramfree = await axios(`http://192.168.1.44:7271/ramfree`)
const dockertotal = await axios(`http://192.168.1.44:7271/dockertotal`)
const nodeuptime = await axios(`http://192.168.1.44:7271/uptime`)
const uptime = prettySeconds(process.uptime())
const embed = new EmbedBuilder()
.setAuthor({name: `${ctx.user.username}`, iconURL: `${ctx.user.displayAvatarURL()}`})
@@ -33,7 +34,9 @@ export default commandModule({
{name: '\u200B', value: '\u200B', inline: true},
{name: 'Contenedores de Docker', value: `${dockertotal.data}`, inline: true},
{name: '\u200B', value: '\u200B', inline: true},
{name: 'Tiempo encendido', value: `${uptime}`},
{name: 'Tiempo encendido', value: `${uptime}`, inline: true},
{name: '\u200B', value: '\u200B', inline: true},
{name: 'Uptime del servidor', value: `${prettySeconds(`${nodeuptime.data}`)}`}
)
await ctx.interaction.editReply({embeds: [embed]})
},

View File

@@ -3,6 +3,7 @@ const port = 8080
const express = require('express');
const app = express();
const si = require('systeminformation');
const os = require('os');
function formatBytes(bytes, decimals = 2) {
if (bytes === 0) return '0 Bytes';
@@ -48,5 +49,10 @@ app.get("/dockertotal", async function (req, res) {
res.send(`${docker.containers}`)
})
app.get("/uptime", async function (req, res) {
const uptime = os.uptime()
res.send(`${uptime}`)
})
// start the server listening for requests
app.listen(port, () => {console.log("The webserver is listening on port " + port)});

View File

@@ -1,12 +0,0 @@
const mongoose = require("mongoose")
const twitchModel = new mongoose.Schema({
title: {
type: String,
required: true
}
})
const twitch = mongoose.model("SrIzan10-twitch-schema", twitchModel)
module.exports = twitch;