Skip to content

Commit

Permalink
📰 process: command added
Browse files Browse the repository at this point in the history
  • Loading branch information
skillzl committed Oct 31, 2023
1 parent 07efe02 commit 45fffdb
Show file tree
Hide file tree
Showing 2 changed files with 57 additions and 1 deletion.
55 changes: 55 additions & 0 deletions commands/app/process.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
const Command = require('../../structures/CommandClass');

const dayjs = require('dayjs');
const packages = require('../../package.json');

const { SlashCommandBuilder, EmbedBuilder, ButtonBuilder, ActionRowBuilder, ButtonStyle, version } = require('discord.js');

module.exports = class Process extends Command {
constructor(client) {
super(client, {
data: new SlashCommandBuilder()
.setName('process')
.setDescription('Application status (also online on website)')
.setDMPermission(false),
usage: 'process',
category: 'App',
permissions: ['Use Application Commands', 'Send Messages', 'Embed Links'],
});
}
async run(client, interaction) {

const btn_one = new ButtonBuilder()
.setURL(process.env.CALLBACK_URL)
.setLabel('website')
.setStyle(ButtonStyle.Link);

const btn_two = new ButtonBuilder()
.setURL('https://github.com/skillzl/eres')
.setLabel('github')
.setStyle(ButtonStyle.Link);

const row = new ActionRowBuilder().addComponents(
btn_one,
btn_two,
);


const embed = new EmbedBuilder()
.setAuthor({ name: `${client.user.username} • Statistics`, iconURL: interaction.guild.iconURL({ dynamic: true, size: 2048, extension: 'png' }) })
.setColor(0x36393e)
.setDescription('Live process values, also seen on our website.')
.addFields(
{ name: 'Process', value: `Memory: ${(process.memoryUsage().rss / 1024 / 1024).toFixed(2)}mb CPU:${(process.cpuUsage().system / 1024 / 1024).toFixed(2)}%\nPing: ${client.ws.ping || 0}ms\nUptime: ${dayjs(client.uptime).format('D [d], H [h], m [m], s [s]')}`, inline: true },
{ name: 'Packages', value: `discord.js: ^${version}\nmongoose: ${packages.dependencies['mongoose']}\nnode.js: ^${process.version}`, inline: true },
{ name: 'Cache', value: `Channels: ${client.channels.cache.size || 0}\nEmojis: ${client.emojis.cache.size || 0 }\nUsers: ${client.users.cache.size || 0}`, inline:true },
)
.setFooter({
text: 'You are experiencing a beta version of this application that may suffer some unfinished features!',
})
.setThumbnail(interaction.guild.iconURL({ dynamic: true, size: 2048, extension: 'png' }));

await interaction.reply({ embeds: [embed], components: [row] });

}
};
3 changes: 2 additions & 1 deletion commands/general/commands.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,11 @@ module.exports = class Commands extends Command {
async run(client, interaction) {

const embed = new EmbedBuilder()
.setAuthor({ name: 'Eres • Commands', iconURL: interaction.guild.iconURL({ dynamic: true, size: 2048, extension: 'png' }) })
.setAuthor({ name: `${client.user.username} • Commands`, iconURL: interaction.guild.iconURL({ dynamic: true, size: 2048, extension: 'png' }) })
.setColor(0x36393e)
.setDescription('Before using any of these commands you are welcomed with a guide.')
.addFields(
{ name: 'App', value: 'process' },
{ name: 'Developer', value: 'database, eval' },
{ name: 'Economy', value: 'balance, daily, fish, hunt, slots, transfer' },
{ name: 'General', value: 'avatar, commands, ping, server, whois' },
Expand Down

0 comments on commit 45fffdb

Please sign in to comment.