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:
62
src/index.ts
Normal file
62
src/index.ts
Normal file
@@ -0,0 +1,62 @@
|
||||
import 'dotenv/config';
|
||||
import { ExtendedClient } from './structures/ExtendedClient.js';
|
||||
import { readdirSync } from 'node:fs';
|
||||
import { fileURLToPath, pathToFileURL } from 'node:url';
|
||||
import { dirname, join } from 'node:path';
|
||||
import { Command } from './structures/Command.js';
|
||||
import { DB } from './structures/Database.js';
|
||||
import { TwitchManager } from './structures/TwitchManager.js';
|
||||
|
||||
const __filename = fileURLToPath(import.meta.url);
|
||||
const __dirname = dirname(__filename);
|
||||
|
||||
// Initialize Database
|
||||
DB.init();
|
||||
|
||||
const client = new ExtendedClient();
|
||||
// Make DB available on client
|
||||
(client as any).DB = DB;
|
||||
|
||||
// Load Commands
|
||||
const commandsPath = join(__dirname, 'commands');
|
||||
const commandFolders = readdirSync(commandsPath);
|
||||
|
||||
for (const folder of commandFolders) {
|
||||
const folderPath = join(commandsPath, folder);
|
||||
const commandFiles = readdirSync(folderPath).filter(file => file.endsWith('.ts'));
|
||||
|
||||
for (const file of commandFiles) {
|
||||
const filePath = join(folderPath, file);
|
||||
const fileUrl = pathToFileURL(filePath).href;
|
||||
const command: Command = (await import(fileUrl)).default;
|
||||
|
||||
if (command && 'data' in command && 'execute' in command) {
|
||||
client.commands.set(command.data.name, command);
|
||||
console.log(`[COMMAND] Loaded: ${command.data.name}`);
|
||||
} else {
|
||||
console.warn(`[COMMAND] The command at ${filePath} is missing a required "data" or "execute" property.`);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Load Events
|
||||
const eventsPath = join(__dirname, 'events');
|
||||
const eventFiles = readdirSync(eventsPath).filter(file => file.endsWith('.ts'));
|
||||
|
||||
for (const file of eventFiles) {
|
||||
const filePath = join(eventsPath, file);
|
||||
const fileUrl = pathToFileURL(filePath).href;
|
||||
const event = (await import(fileUrl)).default;
|
||||
|
||||
if (event.once) {
|
||||
client.once(event.name, (...args) => event.execute(...args, client));
|
||||
} else {
|
||||
client.on(event.name, (...args) => event.execute(...args, client));
|
||||
}
|
||||
console.log(`[EVENT] Loaded: ${event.name}`);
|
||||
}
|
||||
|
||||
// Start Twitch Polling
|
||||
TwitchManager.startPolling(client);
|
||||
|
||||
client.login(process.env.DISCORD_TOKEN);
|
||||
Reference in New Issue
Block a user