Add events module with dashboard UI, scheduling, signups, and settings updates; extend env/readme.
This commit is contained in:
37
src/index.ts
37
src/index.ts
@@ -1,25 +1,44 @@
|
||||
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';
|
||||
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();
|
||||
|
||||
const client = new Client({
|
||||
intents: [
|
||||
GatewayIntentBits.Guilds,
|
||||
GatewayIntentBits.GuildMembers,
|
||||
GatewayIntentBits.GuildMessages,
|
||||
GatewayIntentBits.MessageContent,
|
||||
GatewayIntentBits.GuildVoiceStates
|
||||
GatewayIntentBits.GuildVoiceStates,
|
||||
GatewayIntentBits.GuildMessageReactions
|
||||
],
|
||||
partials: [Partials.Channel, Partials.GuildMember, Partials.Message]
|
||||
partials: [Partials.Channel, Partials.GuildMember, Partials.Message, Partials.Reaction, Partials.User]
|
||||
});
|
||||
|
||||
const commandHandler = new CommandHandler(client);
|
||||
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.birthdays.setClient(client);
|
||||
context.reactionRoles.setClient(client);
|
||||
context.events.setClient(client);
|
||||
context.events.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();
|
||||
|
||||
Reference in New Issue
Block a user