Skip to content

Commit

Permalink
REM-BOT
Browse files Browse the repository at this point in the history
  • Loading branch information
davidprospero123 authored Apr 18, 2024
1 parent 2903283 commit dddbc63
Showing 1 changed file with 69 additions and 58 deletions.
127 changes: 69 additions & 58 deletions plugins/main-botInfo.js
Original file line number Diff line number Diff line change
@@ -1,30 +1,33 @@
import { cpus as _cpus, totalmem, freemem } from 'os'
import util from 'util'
import { performance } from 'perf_hooks'
import { sizeFormatter } from 'human-readable'
import { cpus as _cpus, totalmem, freemem } from 'os';
import util from 'util';
import { performance } from 'perf_hooks';
import { sizeFormatter } from 'human-readable';

let format = sizeFormatter({
std: 'JEDEC', // 'SI' (default) | 'IEC' | 'JEDEC'
std: 'JEDEC',
decimalPlaces: 2,
keepTrailingZeroes: false,
render: (literal, symbol) => `${literal} ${symbol}B`,
})
});

let handler = async (m, { conn, usedPrefix, command }) => {
const chats = Object.entries(conn.chats).filter(([id, data]) => id && data.isChats)
const groupsIn = chats.filter(([id]) => id.endsWith('@g.us')) //groups.filter(v => !v.read_only)
const used = process.memoryUsage()
const chats = Object.entries(conn.chats).filter(([id, data]) => id && data.isChats);
const groupsIn = chats.filter(([id]) => id.endsWith('@g.us'));
const privateChats = chats.filter(([id]) => !id.endsWith('@g.us'));

const cpus = _cpus().map(cpu => {
cpu.total = Object.keys(cpu.times).reduce((last, type) => last + cpu.times[type], 0)
return cpu
})
cpu.total = Object.keys(cpu.times).reduce((last, type) => last + cpu.times[type], 0);
return cpu;
});
const cpu = cpus.reduce((last, cpu, _, { length }) => {
last.total += cpu.total
last.speed += cpu.speed / length
last.times.user += cpu.times.user
last.times.nice += cpu.times.nice
last.times.sys += cpu.times.sys
last.times.idle += cpu.times.idle
last.times.irq += cpu.times.irq
return last
last.total += cpu.total;
last.speed += cpu.speed / length;
last.times.user += cpu.times.user;
last.times.nice += cpu.times.nice;
last.times.sys += cpu.times.sys;
last.times.idle += cpu.times.idle;
last.times.irq += cpu.times.irq;
return last;
}, {
speed: 0,
total: 0,
Expand All @@ -35,50 +38,58 @@ let handler = async (m, { conn, usedPrefix, command }) => {
idle: 0,
irq: 0
}
})
let old = performance.now()
});

let neww = performance.now()
let speed = neww - old
let who = m.quoted ? m.quoted.sender : m.mentionedJid && m.mentionedJid[0] ? m.mentionedJid[0] : m.fromMe ? conn.user.jid : m.sender
if (!(who in global.db.data.users)) throw `✳️ ᴇʟ ᴜꜱᴜᴀʀɪᴏ ɴᴏ ᴇꜱᴛᴀ ᴇɴ ᴍɪ ʙᴀꜱᴇ ᴅᴇ ᴅᴀᴛᴏꜱ :ᴄ`
let pp = await conn.profilePictureUrl(who, 'image').catch(_ => './logo.jpg')
let user = global.db.data.users[who]
let old = performance.now();
await util.promisify(setTimeout)(2000);
let neww = performance.now();
let elapsedTime = neww - old;

let infobt = `
———❅——————❅——————❅——————❅
*ɪɴꜰᴏ ᴅᴇ ʟᴏꜱ ɢʀᴜᴘᴏꜱ*
let target = m.quoted ? m.quoted.sender : m.mentionedJid && m.mentionedJid[0] ? m.mentionedJid[0] : m.fromMe ? conn.user.jid : m.sender;

┌ ؂ *${groupsIn.length}* Chats en Grupos
│ ؂ *${groupsIn.length}* Grupos Unidos
│ ؂ *${groupsIn.length - groupsIn.length}* Grupos Salidos
│ ؂ *${chats.length - groupsIn.length}* Chats Privados
└ ؂ *${chats.length}* Chats Totales
if (!(target in global.db.data.users)) throw `𝙴𝚕 𝚞𝚜𝚞𝚊𝚛𝚒𝚘 𝚗𝚘 𝚎𝚜𝚝á 𝚎𝚗 𝚕𝚊 𝚋𝚊𝚜𝚎 𝚍𝚎 𝚍𝚊𝚝𝚘𝚜`;

*ᴅᴇᴛᴀʟʟᴇꜱ ᴅᴇʟ ʙᴏᴛ ʀᴇᴍ*
let profilePic = await conn.profilePictureUrl(target, 'image').catch(_ => './logo.jpg');
let user = global.db.data.users[target];

┌ ؂ *Creador* : Curi
│ ؂ *Prefijo* : [ ${usedPrefix} ]
│ ؂ *Plataforma* : linux
│ ؂ *RAM* : ${format(totalmem() - freemem())} / ${format(totalmem())}
│ ؂ *FreeRAM* : ${format(freemem())}
│ ؂ *Modo* : Publico
└ ؂ *Nombre* : Rem-Cham
┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓
💙 ᴘᴀɢɪɴᴀ ᴡᴇʙ 💙
– https://rem-cham.replit.app
┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛
*≡ _NodeJS Uso de memoria_*
${'```' + Object.keys(used).map((key, _, arr) => `${key.padEnd(Math.max(...arr.map(v => v.length)), ' ')}: ${format(used[key])}`).join('\n') + '```'}
`
conn.sendFile(m.chat, pp, 'prefil.jpg', infobt, m, false, { mentions: [who] })
m.react(done)
let botname = "REM-BOT";

}
handler.help = ['info']
handler.tags = ['main']
handler.command = ['info', 'infobot', 'botinfo']
let infoMessage = `
╭────〈 ${botname} 〉───
│ 📱 𝚄𝚂𝙾 𝙳𝙴𝙻 𝙱𝙾𝚃:
│ ┌── 💬 𝙲𝙷𝙰𝚃 𝚃𝙾𝚃𝙰𝙻𝙴𝚂: ${chats.length}
│ │ └─ 🗨️ 𝙶𝚁𝚄𝙿𝙾𝚂: ${groupsIn.length}
│ │ └─ 📝 𝙿𝚁𝙸𝚅𝙰𝙳𝙾𝚂: ${privateChats.length}
│ ├── 🕒 𝙴𝙹𝙴𝙲𝚄𝙲𝙸𝙾𝙽: ${elapsedTime.toFixed(2)} 𝙼𝚂
│ ├── 🖥️ Uso de CPU:
│ ├── ${cpu.times.sys.toFixed(2)} 𝙼𝚂 (𝚂𝙸𝚂𝚃𝙴𝙼𝙰)
│ ├── ${cpu.times.user.toFixed(2)} 𝙼𝚂 (𝚄𝚂𝚄𝙰𝚁𝙸𝙾)
│ └── 📊 Memoria RAM: Total
│ └── ${format(totalmem())}, Libre ${format(freemem())}
│ 🤖 𝙳𝙴𝚃𝙰𝙻𝙻𝙴𝚂 𝙳𝙴𝙻 𝙱𝙾𝚃:
│ ┌── 👤 𝙾𝚆𝙽𝙴𝚁 𝙾𝙵𝙲: Curi
│ ├── 🛠️ 𝙿𝚁𝙴𝙵𝙸𝙹𝙾: ${usedPrefix}
│ ├── 🌐 𝙿𝙻𝙰𝚃𝙰𝙵𝙾𝚁𝙼𝙰: Linux
│ └── 🏷️ 𝙾𝙿𝙴𝚁𝙰𝙽𝙳𝙾: Público
│ 🔗 𝙴𝙽𝙻𝙰𝙲𝙴𝚂:
│ └── 🌐 [𝙿𝙰𝙶𝙸𝙽𝙰 𝚆𝙴𝙱]
│ └── (https://rem-cham.replit.app)
│ 🔍 𝚄𝚂𝙾 𝙳𝙴 𝙼𝙴𝙼𝙾𝚁𝙸𝙰 𝙽𝙾𝙳𝙴.𝙹𝚂:
${'```' + Object.keys(process.memoryUsage()).map((key, _, arr) => `${key.padEnd(Math.max(...arr.map(v => v.length)), ' ')}: ${format(process.memoryUsage()[key])}`).join('\n') + '```'}
╰────────────────────
`;

export default handler
conn.sendFile(m.chat, profilePic, 'perfil.jpg', infoMessage, m, false, { mentions: [target] });
m.react('✅');
}

handler.help = ['info'];
handler.tags = ['main'];
handler.command = ['info', 'infobot', 'botinfo'];

export default handler;

0 comments on commit dddbc63

Please sign in to comment.