Skip to content

Commit

Permalink
info
Browse files Browse the repository at this point in the history
  • Loading branch information
weskerty committed Oct 8, 2024
1 parent c7d5c05 commit 95c7d40
Showing 1 changed file with 0 additions and 124 deletions.
124 changes: 0 additions & 124 deletions plugins/info-estado.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import sizeFormatter from "human-readable";
import MessageType from "baileys";
import fs from "fs";
import { performance } from "perf_hooks";
import { exec } from 'child_process';

const handler = async (m, { conn, usedPrefix }) => {
const datas = global
Expand All @@ -32,129 +31,6 @@ const handler = async (m, { conn, usedPrefix }) => {
const wm = 'MysticMOD';
const info = ` ${tradutor.texto1[0]}
function getVersions(callback) {
exec('node -v', (err, nodeVersion) => {
if (err) nodeVersion = '✖️';
exec('npm -v', (err, npmVersion) => {
if (err) npmVersion = '✖️';
exec('ffmpeg -version', (err, ffmpegVersion) => {
if (err) ffmpegVersion = '✖️';
exec('python --version || python3 --version || py --version', (err, pythonVersion) => {
if (err) pythonVersion = '✖️';
exec('pip --version || pip3 --version', (err, pipVersion) => {
if (err) pipVersion = '✖️';
exec('choco -v', (err, chocoVersion) => {
if (err) chocoVersion = '✖️';
callback({ nodeVersion, npmVersion, ffmpegVersion, pythonVersion, pipVersion, chocoVersion });
});
});
});
});
});
});
}
function getStorageInfo(callback) {
if (os.platform() === 'win32') {
exec('wmic logicaldisk get size,freespace,caption', (err, stdout) => {
if (err) return callback('✖️');
const lines = stdout.trim().split('\n').slice(1);
const storageInfo = lines.map(line => {
const [drive, free, total] = line.trim().split(/\s+/);
return `🖥️ ${drive}: ${(total / (1024 ** 3)).toFixed(2)} GB total, ${(free / (1024 ** 3)).toFixed(2)} GB libres`;
}).join('\n');
callback(storageInfo);
});
} else {
exec('df -h --output=source,size,avail,target', (err, stdout) => {
if (err) return callback('✖️');
const lines = stdout.trim().split('\n').slice(1);
const storageInfo = lines.map(line => {
const [device, total, free, mount] = line.trim().split(/\s+/);
return `🖥️ ${mount}: ${total} total, ${free} libres en ${device}`;
}).join('\n');
callback(storageInfo);
});
}
}
function getLinuxInfo(callback) {
exec('cat /etc/os-release', (err, osInfo) => {
if (err) osInfo = '✖️';
callback(osInfo.trim());
});
}
function getBatteryInfo(callback) {
if (os.platform() === 'linux' || os.platform() === 'darwin') {
exec('upower -i $(upower -e | grep BAT)', (err, batteryInfo) => {
if (err) return callback('✖️');
callback(batteryInfo);
});
} else if (os.platform() === 'win32') {
exec('WMIC Path Win32_Battery Get EstimatedChargeRemaining', (err, batteryInfo) => {
if (err) return callback('✖️');
callback(`🔋 ${batteryInfo.trim()}%`);
});
} else {
callback('✖️');
}
}
async function systemInfoPlugin(m, extra) {
try {
const systemInfo = {
platform: os.platform(),
cpuArch: os.arch(),
cpus: os.cpus().length,
totalMemory: (os.totalmem() / (1024 ** 3)).toFixed(2) + ' GB', // Total RAM en GB
freeMemory: (os.freemem() / (1024 ** 3)).toFixed(2) + ' GB', // RAM libre en GB
uptime: formatUptime(os.uptime()), // Tiempo de actividad
osVersion: os.release(), // Versión del SO
loadAverage: os.loadavg().map(load => load.toFixed(2)).join(', ') // Carga promedio
};
getVersions((versions) => {
getBatteryInfo((batteryStatus) => {
getStorageInfo((storageInfo) => {
getLinuxInfo((linuxInfo) => {
let infoMessage = `> *📊 Información del Sistema*\n\n`;
infoMessage += `- 🌐 *Plataforma*: _${systemInfo.platform}_\n`;
infoMessage += `- 💻 *Arquitectura CPU*: ${systemInfo.cpuArch}\n`;
infoMessage += `- 🧠 *Núcleos CPU*: ${systemInfo.cpus}\n`;
infoMessage += `- 🗄️ *Memoria Total*: ${systemInfo.totalMemory}\n`;
infoMessage += `- 🗃️ *Memoria Libre*: ${systemInfo.freeMemory}\n`;
infoMessage += `- ⏱️ *Tiempo de Actividad*: ${systemInfo.uptime}\n`;
infoMessage += `- 📀 *Versión del SO*: ${systemInfo.osVersion}\n`;
infoMessage += `- 📊 *Carga Promedio (1, 5, 15 min)*: ${systemInfo.loadAverage}\n`;
infoMessage += `- 🔋 *Energia*: ${batteryStatus}\n\n`;
infoMessage += `> *💾 Almacenamiento*\n`;
infoMessage += `${storageInfo}\n\n`;
infoMessage += `> *🛠️ Version Herramientas*\n\n`;
infoMessage += `- *Node.js*: ${versions.nodeVersion.trim()}\n`;
infoMessage += `- 📦 *NPM*: ${versions.npmVersion.trim()}\n`;
infoMessage += `- 🎥 *FFmpeg*: ${versions.ffmpegVersion.split('\n')[0]}\n`; // Solo primera linea
infoMessage += `- 🐍 *Python*: ${versions.pythonVersion.trim()}\n`;
infoMessage += `- 📦 *PIP*: ${versions.pipVersion.trim()}\n`;
infoMessage += `- 🍫 *Chocolatey*: ${versions.chocoVersion.trim()}\n\n`;
if (os.platform() === 'linux') {
infoMessage += `> *🐧 Distribución Linux*\n${linuxInfo}\n`;
}
extra.conn.sendMessage(m.chat, { text: infoMessage });
});
});
});
});
} catch (error) {
console.error('Falla Plugin sysinfo:', error);
await extra.conn.sendMessage(m.chat, { text: 'ERROR' });
}
}
${tradutor.texto1[1]}
${tradutor.texto1[2]}
${tradutor.texto1[3]}
Expand Down

0 comments on commit 95c7d40

Please sign in to comment.