Rewrite bot info and embed (#59)

This commit is contained in:
Sophie Marie 2022-07-18 12:03:50 -05:00 committed by GitHub
parent dca559b365
commit a50b45e784
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 54 additions and 102 deletions

View File

@ -1,102 +1,54 @@
const Uptime = require('../functions/uptime.js'); const Uptime = require('../functions/uptime.js');
const os = require('os'); const os = require('os');
const osu = require('node-os-utils'); const osu = require('node-os-utils');
const cpu = osu.cpu; const config = require('../config.json');
module.exports = {
module.exports = { name: 'info',
description: 'Bot and System information',
name: require('path').parse(__filename).name, options: [],
description: 'Shows bot and host information',
options: [], async parseMessage (client, config, message) {
await message.channel.send(this.handle(client, config, message.author));
async parseMessage (client, config, message) { },
await message.channel.send(this.handle(client, config, message.author)); // We'll be moving solely to Slash Commands in 1.4
},
async parseInteraction (client, config, interaction) {
async parseInteraction (client, config, interaction) { await interaction.reply(this.handle(client, config, interaction.user));
await interaction.reply(this.handle(client, config, interaction.user)); },
},
handle (client, config, user) {
handle (client, config, user) { return {
return { embeds: [{
embeds: [{ title: `<:AnitroxInfo:809651936831733791> Information about ${client.user.username}`,
title: '<:AnitroxInfo:809651936831733791> Information about Anitrox', description: `Everything you've ever wanted to know about your favorite bot, ${client.user.username}!`,
description: "Everything you've ever wanted to know about your favorite bot, Anitrox!", color: 9442302,
color: 9442302, footer: {
footer: { icon_url: user.displayAvatarURL(),
icon_url: user.displayAvatarURL(), text: config.footerTxt
text: config.footerTxt },
}, thumbnail: {
thumbnail: { url: client.user.displayAvatarURL()
url: client.user.displayAvatarURL() },
}, fields: [
fields: [ { name: '<:anitrox:831193012699791361> Bot Information', value: '** **' },
{ { name: 'Bot Name', value: `${client.user.tag}`, inline: true },
name: 'Bot Information', { name: 'Bot ID', value: `${client.user.id}`, inline: true },
value: '** **' { name: 'Bot Owner', value: isNaN(config.ownerID) ? "Owner didn't set an OwnerID :(" : client.users.cache.get(config.ownerID).username, inline: true },
}, { name: 'Release Type', value: config.release, inline: true },
{ { name: 'Version', value: config.build, inline: true },
name: 'Release Type', { name: ':gear: Bot Process Information', value: '** **' },
value: config.release, { name: '<:memory:997565609179107369> Bot Memory Usage', value: `${(process.memoryUsage().heapUsed / 1024 / 1024).toFixed(2)} MiB`, inline: true },
inline: true { name: ':timer: Bot Uptime', value: Uptime(client.uptime), inline: true },
}, { name: ':one: Total Servers', value: `** **${client.guilds.cache.size}`, inline: true },
{ { name: '<:hostinfo:997565639352926250> System Information', value: '** **' },
name: 'Release Version', { name: `${((process.platform === 'linux') ? '<:linux_tux:997565742960615424>' : '<:windows:997919047511453696>')} System Platform`, value: process.platform, inline: true },
value: config.build, { name: `${((process.platform === 'linux') ? ':gear: Kernel Version' : ':gear: System Version')}`, value: os.release(), inline: true },
inline: true { name: ':timer: System Uptime', value: Uptime(os.uptime() * 1000), inline: true },
}, { name: '<:cpu:997565592028598282> System CPU Architecture', value: os.arch(), inline: true },
{ { name: '<:cpu:997565592028598282> System CPU Model', value: osu.cpu.model(), inline: true },
name: 'Uptime', { name: '<:nodejs:998609124453531740> Node.js Version', value: process.version, inline: true }
value: Uptime(client.uptime), ]
inline: true }]
}, };
{ }
name: '<:memory:793536677737136178> Bot Memory Usage', };
value: `${(process.memoryUsage().heapUsed / 1024 / 1024).toFixed(2)} MiB`,
inline: true
},
{
name: 'Bot Name',
value: client.user.tag,
inline: true
},
{
name: 'Bot ID',
value: `\`${client.user.id}\``,
inline: true
},
{
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()}`
},
{
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: '**Special Thanks To**',
value: '@OfficialTCGMatt for providing help with development\n @chuu_shi Allowing me to host Anitrox on his server'
}
]
}]
};
}
};