Files
Papo/src/index.ts
Pepe44DEV aa246cd7ea
Some checks failed
Deploy Discord Bot / deploy (push) Failing after -1m12s
SonarQube / sonar (push) Successful in 4s
add badges, weekly plans, polls, suggestions, mod-case system, branding, partner system, alt-account detection, gallery, growth tracking
Two feature batches plus a deploy fix:

Moderation & engagement: persistent ModCase history (retrofits ban/kick/
mute/timeout/tempban to record cases), /warn, /watch watchlist with
automatic alerts on deletions/tickets/automod hits, /case file lookup,
achievement badges (/badges, /profile) with message/streak/ticket/
birthday/event/booster triggers, /weekplan RSVP boards, /poll with
anonymous mode and scheduled auto-close, /suggest with vote/comment/
decide flow.

Branding & growth: /branding (per-guild embed color/logo/footer/bot
name/theme, applied across logging/ticket/register/embed-builder
embeds and the dashboard sidebar/accent color at runtime), two new
/setup server-type presets (Roleplay, Creator), /rules generate
(template-based rule sets), /partner apply/list/config with invite
validation and showcase posting, alt-account suspicion scoring on
join (account age, avatar, name pattern, join bursts, ban-list
similarity), /gallery submit with voting and weekly-winner scheduler,
invite-attributed join/leave tracking with a new Wachstum dashboard
page, and an expanded Admin dashboard (guild list, feature-usage
counters).

Also fixes production: the Docker container never ran `prisma migrate
deploy`, so schema changes never reached the live database. The
compose command now applies pending migrations on every start.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-07-03 23:15:35 +02:00

62 lines
2.2 KiB
TypeScript

import { Client, GatewayIntentBits, Partials } from 'discord.js';
import { env } from './config/env';
import { CommandHandler } from './services/commandHandler';
import { EventHandlerService } from './services/eventHandler';
import { logger } from './utils/logger';
import { context } from './config/context';
import { createWebServer } from './web/server';
import { settingsStore } from './config/state';
async function bootstrap() {
context.admin.setStartTime(Date.now());
await settingsStore.init();
await context.watchlist.loadAll();
const client = new Client({
intents: [
GatewayIntentBits.Guilds,
GatewayIntentBits.GuildMembers,
GatewayIntentBits.GuildMessages,
GatewayIntentBits.MessageContent,
GatewayIntentBits.GuildVoiceStates,
GatewayIntentBits.GuildMessageReactions
],
partials: [Partials.Channel, Partials.GuildMember, Partials.Message, Partials.Reaction, Partials.User]
});
const commandHandler = new CommandHandler(client, context.admin, context.statuspage);
context.commandHandler = commandHandler;
context.client = client;
context.admin.setClient(client);
context.statuspage.setClient(client);
context.tickets.setClient(client);
context.ticketAutomation.startLoop();
context.birthdays.setClient(client);
context.reactionRoles.setClient(client);
context.events.setClient(client);
context.events.startScheduler();
context.register.setClient(client);
context.stats.setClient(client);
context.polls.setClient(client);
context.polls.startScheduler();
await context.reactionRoles.loadCache();
logger.setSink((entry) => context.admin.pushLog(entry));
for (const gid of settingsStore.all().keys()) {
const cfg = await context.statuspage.getConfig(gid);
await context.statuspage.saveConfig(gid, cfg);
}
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));