Update from Git Manager GUI
This commit is contained in:
68
commands/info.js
Normal file
68
commands/info.js
Normal file
@@ -0,0 +1,68 @@
|
||||
import { EmbedBuilder, SlashCommandBuilder } from "discord.js";
|
||||
|
||||
export default {
|
||||
name: "info",
|
||||
description: "Informationen über den Bot",
|
||||
aliases: ["botinfo"],
|
||||
guild: ["all"],
|
||||
nsfw: false,
|
||||
user_permissions: [],
|
||||
bot_permissions: [],
|
||||
args_required: 0,
|
||||
args_usage: "",
|
||||
cooldown: 5,
|
||||
|
||||
data: new SlashCommandBuilder()
|
||||
.setName("info")
|
||||
.setDescription("Zeigt Informationen über den Bot an"),
|
||||
|
||||
async execute(client, ctx) {
|
||||
let totalMembers = 0;
|
||||
client.bot.guilds.cache.forEach((guild) => { totalMembers += guild.memberCount; });
|
||||
|
||||
const uptime = getUptime(client.bot);
|
||||
const memUsed = (process.memoryUsage().heapUsed / 1024 / 1024).toFixed(1);
|
||||
const nodeVer = process.version;
|
||||
|
||||
const infoEmbed = new EmbedBuilder()
|
||||
.setAuthor({
|
||||
name: client.config.authorName,
|
||||
url: client.config.authorGithub,
|
||||
iconURL: client.bot.user.displayAvatarURL(),
|
||||
})
|
||||
.setColor(ctx.guild.members.me.displayHexColor)
|
||||
.setTitle(`ℹ️ ${client.bot.user.username} – Bot-Informationen`)
|
||||
.setThumbnail(client.bot.user.displayAvatarURL())
|
||||
.addFields([
|
||||
{ name: "🤖 Bot-Name", value: client.config.botName, inline: true },
|
||||
{ name: "👨💻 Entwickler", value: `[${client.config.authorName}](${client.config.authorGithub})`, inline: true },
|
||||
{ name: "📦 Version", value: client.packageData.version, inline: true },
|
||||
{ name: "⏱️ Laufzeit", value: uptime, inline: true },
|
||||
{ name: "🌐 Server", value: `${client.bot.guilds.cache.size}`, inline: true },
|
||||
{ name: "👥 Nutzer", value: `${totalMembers.toLocaleString("de-DE")}`, inline: true },
|
||||
{ name: "💬 Kanäle", value: `${client.bot.channels.cache.size}`, inline: true },
|
||||
{ name: "🔧 Befehle", value: `${client.commands.size}`, inline: true },
|
||||
{ name: "💾 Speicher", value: `${memUsed} MB`, inline: true },
|
||||
{ name: "🟢 Node.js", value: nodeVer, inline: true },
|
||||
{ name: "📚 discord.js", value: `v14`, inline: true },
|
||||
{ name: "🔗 Einladen", value: `[Bot einladen](https://discord.com/oauth2/authorize?client_id=${client.config.inviteClientID}&scope=bot&permissions=8)`, inline: true },
|
||||
])
|
||||
.setFooter({ text: `${client.config.botName} • SpigotMC Plugin Update Tracker` })
|
||||
.setTimestamp();
|
||||
|
||||
return ctx.reply({ embeds: [infoEmbed] });
|
||||
},
|
||||
};
|
||||
|
||||
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`;
|
||||
}
|
||||
Reference in New Issue
Block a user