-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
57 additions
and
1 deletion.
There are no files selected for viewing
This file contains 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
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] }); | ||
|
||
} | ||
}; |
This file contains 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