This repository has been archived on 2024-01-30. You can view files and clone it, but cannot push or open issues or pull requests.
anitrox/commands/info.js

114 lines
4.0 KiB
JavaScript
Raw Normal View History

2022-03-17 23:47:04 -05:00
const { Client, ClientUser } = require('discord.js');
2021-01-19 14:02:09 -06:00
module.exports = {
2021-01-19 14:02:09 -06:00
name: 'info',
description: 'Shows bot and host information',
2022-01-12 13:13:23 -06:00
execute(client, message, args) {
2022-03-17 23:47:04 -05:00
const { build, release, footerTxt } = require('../config.json');
2021-01-19 14:02:09 -06:00
function Uptime(uptimetype) {
let totalSeconds = (uptimetype / 1000);
let days = parseInt(Math.floor(totalSeconds / 86400)) + " day";
let hours = Math.floor(parseInt(Math.floor(totalSeconds / 3600)) % 24) + " hour";
totalSeconds %= 3600;
let minutes = parseInt(Math.floor(totalSeconds / 60)) + " minute";
let seconds = parseInt(totalSeconds % 60) + " second";
if (parseInt(days.substring(0,2)) != 1) days += "s";
if (parseInt(hours.substring(0,3)) != 1) hours += "s";
if (parseInt(minutes.substring(0,3)) != 1) minutes += "s";
if (parseInt(seconds.substring(0,3)) != 1) seconds += "s";
let uptime = `${days}**, **${hours}**, **${minutes}**, **${seconds}`;
return uptime;
};
const os = require("os")
var osu = require('node-os-utils')
var cpu = osu.cpu
let botAvatar = client.user.displayAvatarURL()
2021-01-19 14:02:09 -06:00
const embed = {
"title": "<:AnitroxInfo:809651936831733791> Information about Anitrox",
2022-03-17 23:47:04 -05:00
"description": "Everything you've ever wanted to know about your favorite bot, Anitrox!",
2021-02-23 00:18:07 -06:00
"color": 9442302,
2021-01-19 14:02:09 -06:00
"footer": {
2022-03-17 23:47:04 -05:00
"icon_url": message.author.displayAvatarURL(),
"text": footerTxt
2021-01-19 14:02:09 -06:00
},
"thumbnail": {
2022-03-17 23:47:04 -05:00
"url": client.user.displayAvatarURL()
2021-01-19 14:02:09 -06:00
},
"fields": [
{
"name": "Bot Information",
"value": "** **"
},
{
"name": "Release Type",
2022-03-17 23:47:04 -05:00
"value": release,
"inline": true
2021-01-19 14:02:09 -06:00
},
{
"name": "Release Version",
2022-03-17 23:47:04 -05:00
"value": build,
"inline": true
2021-01-19 14:02:09 -06:00
},
{
"name": "Uptime",
2022-03-17 23:47:04 -05:00
"value": Uptime(client.uptime),
"inline": true
2021-01-19 14:02:09 -06:00
},
{
"name": "<:memory:793536677737136178> Bot Memory Usage",
2022-03-17 23:47:04 -05:00
"value": (Math.round(process.memoryUsage().heapUsed / 1024 / 1024 * 100) / 100) + " MiB",
"inline": true
},
{
"name": "Bot Name",
"value": client.user.tag,
"inline": true
},
{
"name": "Bot ID",
"value": "``" + client.user.id + "``",
"inline": true
2021-01-19 14:02:09 -06:00
},
{
"name": "<:hostinfo:793529505263517747> Host Information",
"value": "** **"
},
{
"name": "<:hostinfo:793529505263517747> Host Uptime",
"value": Uptime(os.uptime() * 1000)
},
{
"name": "<:cpu:793672442056802354> CPU Type",
"value": process.arch + ", " + cpu.model()
2021-01-19 14:02:09 -06:00
},
2021-01-19 14:02:09 -06:00
{
"name": "<:hostos:793866961675223090> OS Type",
"value": process.platform + " / " + os.version()
},
{
"name": "<:node:793537507018145813> Node.JS Version",
"value": process.version
},
{
"name": "<:hostinfo:793529505263517747> Bot Ping",
"value": Math.round(client.ws.ping) + " ms",
"inline": true
},
{
"name": "<:usersuccess:793885338250641469> **Special Thanks To**",
2021-02-23 00:18:07 -06:00
"value": "@OfficialTCGMatt for providing help with development\n @chuu_shi Allowing me to host Anitrox on his server"
2021-01-19 14:02:09 -06:00
}
]
};
message.channel.send({ embed });
}
2021-01-19 21:37:55 -06:00
};