51 lines
1.9 KiB
JavaScript
51 lines
1.9 KiB
JavaScript
import { EmbedBuilder, SlashCommandBuilder } from "discord.js";
|
|
|
|
export default {
|
|
name: "stats",
|
|
description: "Verschiedene Statistiken des Bots!",
|
|
aliases: [],
|
|
guild: ["all"],
|
|
nsfw: false,
|
|
user_permissions: [],
|
|
bot_permissions: [],
|
|
args_required: 0,
|
|
args_usage: "",
|
|
cooldown: 5,
|
|
|
|
data: new SlashCommandBuilder()
|
|
.setName("stats")
|
|
.setDescription("Zeigt Statistiken des Bots an"),
|
|
|
|
async execute(client, ctx) {
|
|
let members = 0;
|
|
client.bot.guilds.cache.forEach((guild) => { members += guild.memberCount; });
|
|
|
|
const embed = new EmbedBuilder()
|
|
.setAuthor({ name: client.config.authorName, url: client.config.authorGithub })
|
|
.setColor(ctx.guild.members.me.displayHexColor)
|
|
.setTitle(`📊 ${ctx.guild.members.me.displayName} Statistiken`)
|
|
.addFields([
|
|
{ name: "📦 Version", value: `${client.packageData.version}`, inline: true },
|
|
{ name: "👥 Nutzer", value: `${members.toLocaleString("de-DE")}`, inline: true },
|
|
{ name: "💬 Kanäle", value: `${client.bot.channels.cache.size}`, inline: true },
|
|
{ name: "🌐 Server", value: `${client.bot.guilds.cache.size}`, inline: true },
|
|
{ name: "🔧 Befehle", value: `${client.commands.size}`, inline: true },
|
|
{ name: "⏱️ Laufzeit", value: getUptime(client.bot), inline: true },
|
|
]);
|
|
|
|
return ctx.reply({ embeds: [embed] });
|
|
},
|
|
};
|
|
|
|
function getUptime(bot) {
|
|
let total = bot.uptime / 1000;
|
|
const days = Math.floor(total / 86400); total %= 86400;
|
|
const hours = Math.floor(total / 3600); total %= 3600;
|
|
const minutes = Math.floor(total / 60);
|
|
const seconds = Math.floor(total % 60);
|
|
|
|
if (days > 0) return `${days}T ${hours}Std ${minutes}Min ${seconds}Sek`;
|
|
if (hours > 0) return `${hours}Std ${minutes}Min ${seconds}Sek`;
|
|
if (minutes > 0) return `${minutes}Min ${seconds}Sek`;
|
|
return `${seconds}Sek`;
|
|
} |