feat: initial Papo bot scaffold
This commit is contained in:
36
src/index.ts
Normal file
36
src/index.ts
Normal file
@@ -0,0 +1,36 @@
|
||||
import { Client, GatewayIntentBits, Partials } from 'discord.js';
|
||||
import { env } from './config/env.js';
|
||||
import { CommandHandler } from './services/commandHandler.js';
|
||||
import { EventHandlerService } from './services/eventHandler.js';
|
||||
import { logger } from './utils/logger.js';
|
||||
import { context } from './config/context.js';
|
||||
import { createWebServer } from './web/server.js';
|
||||
|
||||
async function bootstrap() {
|
||||
const client = new Client({
|
||||
intents: [
|
||||
GatewayIntentBits.Guilds,
|
||||
GatewayIntentBits.GuildMembers,
|
||||
GatewayIntentBits.GuildMessages,
|
||||
GatewayIntentBits.MessageContent,
|
||||
GatewayIntentBits.GuildVoiceStates
|
||||
],
|
||||
partials: [Partials.Channel, Partials.GuildMember, Partials.Message]
|
||||
});
|
||||
|
||||
const commandHandler = new CommandHandler(client);
|
||||
context.commandHandler = commandHandler;
|
||||
|
||||
await commandHandler.loadCommands();
|
||||
await commandHandler.registerSlashCommands();
|
||||
|
||||
const eventHandler = new EventHandlerService(client);
|
||||
await eventHandler.loadEvents();
|
||||
|
||||
client.login(env.token);
|
||||
|
||||
const app = createWebServer();
|
||||
app.listen(env.port, () => logger.info(`Webserver läuft auf Port ${env.port}`));
|
||||
}
|
||||
|
||||
bootstrap().catch((err) => logger.error('Bootstrap failed', err));
|
||||
Reference in New Issue
Block a user