Initial: Pixelpöbel Discord Bot
Some checks failed
Auto Build and Push Docker Image / build (push) Failing after 8s
Some checks failed
Auto Build and Push Docker Image / build (push) Failing after 8s
- Modular Discord Bot mit TypeScript und discord.js - Grouped Commands (/admin, /owner subcommands) - SQLite Datenbank mit Persistenz - Twitch Monitoring mit Stream-ID Tracking - Konfigurierbares Warn-System (Auto-Kick/Mute/Ban) - Mute mit verschiedenen Zeiteinheiten (sec, min, hour, day, week, month, year, perm) - Auto-Deploy beim Start (Option 3) - Docker Support Features: - /ping, /help, /twitch (online, add, remove, list) - /admin (kick, warn, unwarn, mute, unmute, ban, unban, config) - /owner (deploy, stats, servers) Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
107
src/commands/utility/owner.ts
Normal file
107
src/commands/utility/owner.ts
Normal file
@@ -0,0 +1,107 @@
|
||||
import { SlashCommandBuilder, EmbedBuilder } from 'discord.js';
|
||||
import { Command } from '../../structures/Command.js';
|
||||
import { Deployer } from '../../structures/Deployer.js';
|
||||
|
||||
const command: Command = {
|
||||
data: new SlashCommandBuilder()
|
||||
.setName('owner')
|
||||
.setDescription('Bot-Owner Commands')
|
||||
.addSubcommand(subcommand =>
|
||||
subcommand
|
||||
.setName('deploy')
|
||||
.setDescription('Aktualisiert Commands'))
|
||||
.addSubcommand(subcommand =>
|
||||
subcommand
|
||||
.setName('stats')
|
||||
.setDescription('Zeigt Bot-Statistiken'))
|
||||
.addSubcommand(subcommand =>
|
||||
subcommand
|
||||
.setName('servers')
|
||||
.setDescription('Listet alle Server'))
|
||||
.setDMPermission(true),
|
||||
category: 'Owner',
|
||||
async execute(interaction: any, client: any) {
|
||||
if (!client.application?.owner) await client.application?.fetch();
|
||||
|
||||
if (interaction.user.id !== client.application?.owner?.id) {
|
||||
await interaction.reply({ content: 'Keine Berechtigung.', ephemeral: true });
|
||||
return;
|
||||
}
|
||||
|
||||
const subcommand = interaction.options.getSubcommand();
|
||||
|
||||
if (subcommand === 'deploy') {
|
||||
await interaction.deferReply({ ephemeral: true });
|
||||
|
||||
try {
|
||||
const count = await Deployer.deploy(client.user!.id, client.token!);
|
||||
await interaction.editReply(`✅ ${count} Befehle aktualisiert!`);
|
||||
} catch (error) {
|
||||
console.error(error);
|
||||
await interaction.editReply('❌ Fehler beim Deployment.');
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
if (subcommand === 'stats') {
|
||||
await interaction.deferReply({ ephemeral: true });
|
||||
|
||||
const uptime = process.uptime();
|
||||
const days = Math.floor(uptime / 86400);
|
||||
const hours = Math.floor(uptime / 3600) % 24;
|
||||
const minutes = Math.floor(uptime / 60) % 60;
|
||||
const uptimeStr = `${days}d ${hours}h ${minutes}m`;
|
||||
|
||||
const totalServers = client.guilds.cache.size;
|
||||
const totalUsers = client.guilds.cache.reduce((acc: number, guild: any) => acc + guild.memberCount, 0);
|
||||
|
||||
const embed = new EmbedBuilder()
|
||||
.setTitle('📊 Bot-Statistiken')
|
||||
.setColor(0x3498db)
|
||||
.addFields(
|
||||
{ name: '🤖 Bot', value: `**Uptime:** ${uptimeStr}\n**Latency:** ${client.ws.ping}ms`, inline: true },
|
||||
{ name: '🌍 Netzwerk', value: `**Server:** ${totalServers}\n**Nutzer:** ${totalUsers}`, inline: true }
|
||||
)
|
||||
.setTimestamp();
|
||||
|
||||
await interaction.editReply({ embeds: [embed] });
|
||||
return;
|
||||
}
|
||||
|
||||
if (subcommand === 'servers') {
|
||||
await interaction.deferReply({ ephemeral: true });
|
||||
|
||||
const guilds = client.guilds.cache.map((guild: any) =>
|
||||
`• **${guild.name}** \`(${guild.id})\` - ${guild.memberCount} Mitglieder`
|
||||
);
|
||||
|
||||
const chunks = [];
|
||||
for (let i = 0; i < guilds.length; i += 10) {
|
||||
chunks.push(guilds.slice(i, i + 10).join('\n'));
|
||||
}
|
||||
|
||||
if (chunks.length === 0) {
|
||||
await interaction.editReply('Keine Server.');
|
||||
return;
|
||||
}
|
||||
|
||||
const embed = new EmbedBuilder()
|
||||
.setTitle(`🌍 Server (${client.guilds.cache.size})`)
|
||||
.setColor(0xf1c40f)
|
||||
.setDescription(chunks[0].substring(0, 4000))
|
||||
.setTimestamp();
|
||||
|
||||
await interaction.editReply({ embeds: [embed] });
|
||||
|
||||
for (let i = 1; i < chunks.length; i++) {
|
||||
const nextEmbed = new EmbedBuilder()
|
||||
.setColor(0xf1c40f)
|
||||
.setDescription(chunks[i].substring(0, 4000));
|
||||
await interaction.followUp({ embeds: [nextEmbed], ephemeral: true });
|
||||
}
|
||||
return;
|
||||
}
|
||||
},
|
||||
};
|
||||
|
||||
export default command;
|
||||
Reference in New Issue
Block a user