mirror of
https://github.com/darksaid98/cadence-discord-bot.git
synced 2026-12-02 14:38:49 +00:00
Added system command /status
This commit is contained in:
1 parent
64543752ae
commit
5d986a2e6b
1 file changed
+58
@@ -0,0 +1,58 @@
|
||||
const { SlashCommandBuilder } = require('@discordjs/builders');
|
||||
const { EmbedBuilder } = require('discord.js');
|
||||
const {
|
||||
embedColors,
|
||||
systemServerGuildId,
|
||||
botOwnerClientId
|
||||
} = require('../config.json');
|
||||
|
||||
module.exports = {
|
||||
data: new SlashCommandBuilder()
|
||||
.setName('status')
|
||||
.setDescription('Show bot status.'),
|
||||
run: async ({ interaction, client }) => {
|
||||
if (
|
||||
interaction.guildId !== systemServerGuildId ||
|
||||
interaction.user.id !== botOwnerClientId
|
||||
) {
|
||||
return await interaction.editReply({
|
||||
embeds: [
|
||||
new EmbedBuilder()
|
||||
.setDescription(
|
||||
`**No permission**\nYou do not have permission to use this command.`
|
||||
)
|
||||
.setColor(embedColors.colorError)
|
||||
]
|
||||
});
|
||||
}
|
||||
|
||||
let uptimeInSeconds = process.uptime();
|
||||
let uptimeDate = new Date(0);
|
||||
uptimeDate.setSeconds(uptimeInSeconds.toFixed(0));
|
||||
let uptimeString = uptimeDate.toISOString().substring(11, 19);
|
||||
|
||||
return await interaction.editReply({
|
||||
embeds: [
|
||||
new EmbedBuilder()
|
||||
.setDescription(
|
||||
`**Bot Status**\n` +
|
||||
`Uptime: \`${uptimeString}\`\n` +
|
||||
`Memory Usage: \`${(
|
||||
process.memoryUsage().heapUsed /
|
||||
1024 /
|
||||
1024
|
||||
).toFixed(2)} MB\`\n` +
|
||||
`Node Version: \`${process.version}\`\n` +
|
||||
`Discord.js Version: \`v${
|
||||
require('discord.js').version
|
||||
}\`\n` +
|
||||
`Discord Player Version: \`v${
|
||||
require('discord-player').version
|
||||
}\`\n` +
|
||||
`Joined guilds: \`${client.guilds.cache.size}\``
|
||||
)
|
||||
.setColor(embedColors.colorInfo)
|
||||
]
|
||||
});
|
||||
}
|
||||
};
|
||||
Reference in new issue
Block a user