Skip to content

Instantly share code, notes, and snippets.

@ikr4-m
Forked from ItzMeDwii/stats.js
Last active June 8, 2018 03:08
Show Gist options
  • Save ikr4-m/56bdafd1d725ea9d3b34a1c786d7ca67 to your computer and use it in GitHub Desktop.
Save ikr4-m/56bdafd1d725ea9d3b34a1c786d7ca67 to your computer and use it in GitHub Desktop.
const Discord = require("discord.js")
const moment = require('moment');
const _fs = require("fs");
const packages = JSON.parse(_fs.readFileSync('./package.json', 'utf-8'));
require('moment-duration-format');
const os = require('os');
let cpu = os.cpus();
exports.run = (client, message, args, tools) => {
const duration = moment.duration(client.uptime).format(" D [days], H [hrs], m [mins], s [secs]");
const servers = client.guilds.size
const client_channel = client.guilds.reduce((a, b) => a + b.channels.size, 0).toLocaleString()
const owner = packages.author
const idowner = packages.idauthor
const cpu = process.cpuUsage().system / 1024 / 1024;
const users = client.guilds.reduce((a, b) => a + b.memberCount, 0).toLocaleString()
const nodever = process.version
const memory_on_bot = (process.memoryUsage().rss / 1024 / 1024).toFixed(2)
const embed = new Discord.RichEmbed({
title: "Mori Summer Stats",
url: "https://github.com/skymunn/Mori-Summer-Discord/",
// warnanya ini, ente cari dalam bentuk hexa dulu
// terus ente convert jadi desimal
color: 15554891,
footer: {
icon_url: "https://cdn.discordapp.com/avatars/451394160440770601/795d0d2e2e297a3aab3a3b3f9f994617.png",
text: "Powered by SeriousMunn"
},
author: {
name: "Mori Summer | A Discord Bot",
icon_url: "https://cdn.discordapp.com/avatars/451394160440770601/795d0d2e2e297a3aab3a3b3f9f994617.png",
url: "https://github.com/skymunn/Mori-Summer-Discord"
},
fields: [
{ name: "Bot Uptime", value: `• ${duration}`, inline: true },
{ name: "Memory Usage", value: `• ${memory_on_bot} MB`, inline: true },
{ name: "Advanced Stats", value: `• ${servers} Servers \n• ${users} Users \n• ${client_channel} Channels`, inline: true },
{ name: "Bot Informations", value: `\n• Node.js: ${packages.engines.node} \n• Bot Developer: ${owner} \n• Bot Version: ${packages.version}`, inline: true },
{ name: "CPU Usage", value: `• ${Math.round(cpu * 100) / 100}%`, inline: true }
]
}).setTimestamp();
message.channel.send({embed});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment