Created
July 28, 2021 02:46
-
-
Save DarrenOfficial/117a926af32fa8cd44ff9ac34bc3da1e to your computer and use it in GitHub Desktop.
Status JS
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const { MessageEmbed } = require("discord.js"); | |
require("moment-duration-format"); | |
const cpuStat = require("cpu-stat"); | |
const moment = require("moment"); | |
module.exports = { | |
name: "stats", | |
description: "Get information about the bot", | |
usage: "", | |
permissions: { | |
channel: ["VIEW_CHANNEL", "SEND_MESSAGES", "EMBED_LINKS"], | |
member: [], | |
}, | |
aliases: ["about", "ping", "info", "anyonehere", "sex", "flurry"], | |
/** | |
* | |
* @param {import("../structures/DiscordMusicBot")} client | |
* @param {import("discord.js").Message} message | |
* @param {string[]} args | |
* @param {*} param3 | |
*/ | |
run: async (client, message) => { | |
const { version } = require("discord.js") | |
cpuStat.usagePercent(async function (err, percent, seconds) { | |
if (err) { | |
return console.log(err); | |
} | |
const duration = moment.duration(message.client.uptime).format(" D[d], H[h], m[m]"); | |
const embed = new MessageEmbed() | |
embed.setColor("RANDOM") | |
embed.setFooter(`Requested by ${message.author.tag}.`, message.author.displayAvatarURL()); | |
embed.setTitle(`Stats from Nathan's`) | |
embed.setTimestamp() | |
embed.addFields({ | |
name: '<:ping:854804948129939506> Ping', | |
value: `┕\`${Math.round(client.ws.ping)}ms\``, | |
inline: true | |
}, | |
{ | |
name: '<a:benchmark:854804430973304842> Uptime', | |
value: `┕\`${duration}\``, | |
inline: true | |
},{ | |
name: '<:ramverynice:854804050180571146> Memory', | |
value: `┕\`${(process.memoryUsage().heapUsed / 1024 / 1024).toFixed(2)}mb\``, | |
inline: true | |
}) | |
embed.addFields({ | |
name: ':homes: Servers', | |
value: `┕\`${client.guilds.cache.size}\``, | |
inline: true | |
}, | |
{ | |
name: '<:people:854803638228353065> Users', | |
value: `┕\`${client.users.cache.size}\``, | |
inline: true | |
},{ | |
name: '<a:winload:854803227395883029> API Latency', | |
value: `┕\`${(message.client.ws.ping)}ms\``, | |
inline: true | |
}) | |
embed.addFields({ | |
name: '<:hubot:854802685220225044> Version', | |
value: `┕\`vbeta1.0\``, | |
inline: true | |
},{ | |
name: '<:djsdev:854802118943047720> Discord.js', | |
value: `┕\`v${version}\``, | |
inline: true | |
},{ | |
name: '<:nodejs:854801162263593001> Node', | |
value: `┕\`${process.version}\``, | |
inline: true | |
}) | |
return message.channel.send(embed); | |
}) | |
}, | |
SlashCommand: { | |
/** | |
* | |
* @param {import("../structures/DiscordMusicBot")} client | |
* @param {import("discord.js").Message} message | |
* @param {string[]} args | |
* @param {*} param3 | |
*/ | |
run: async (client, interaction) => { | |
const { version } = require("discord.js") | |
cpuStat.usagePercent(async function (err, percent, seconds) { | |
if (err) { | |
return console.log(err); | |
} | |
const duration = moment.duration(client.uptime).format(" D[d], H[h], m[m]"); | |
const embed = new MessageEmbed() | |
embed.setColor("RANDOM") | |
embed.setTitle(`Stats from \`${client.user.username}\``) | |
embed.addFields({ | |
name: '<:ping:854804948129939506> Ping', | |
value: `┕\`${Math.round(client.ws.ping)}ms\``, | |
inline: true | |
}, | |
{ | |
name: '<a:benchmark:854804430973304842> Uptime', | |
value: `┕\`${duration}\``, | |
inline: true | |
},{ | |
name: '<:ramverynice:854804050180571146> Memory', | |
value: `┕\`${(process.memoryUsage().heapUsed / 1024 / 1024).toFixed(2)}mb\``, | |
inline: true | |
}) | |
embed.addFields({ | |
name: ':homes: Servers', | |
value: `┕\`${client.guilds.cache.size}\``, | |
inline: true | |
}, | |
{ | |
name: '<:people:854803638228353065> Users', | |
value: `┕\`${client.users.cache.size}\``, | |
inline: true | |
},{ | |
name: '<a:winload:854803227395883029> API Latency', | |
value: `┕\`${(client.ws.ping)}ms\``, | |
inline: true | |
}) | |
embed.addFields({ | |
name: '<:hubot:854802685220225044> Version', | |
value: `┕\`vbeta1.0\``, | |
inline: true | |
},{ | |
name: '<:djsdev:854802118943047720> Discord.js', | |
value: `┕\`v${version}\``, | |
inline: true | |
},{ | |
name: '<:nodejs:854801162263593001> Node', | |
value: `┕\`${process.version}\``, | |
inline: true | |
}) | |
return interaction.send(embed); | |
}) | |
} | |
} | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment