Add events module with dashboard UI, scheduling, signups, and settings updates; extend env/readme.
This commit is contained in:
@@ -1,15 +1,33 @@
|
||||
import { Client } from 'discord.js';
|
||||
import { EventHandler } from '../utils/types.js';
|
||||
import { logger } from '../utils/logger.js';
|
||||
import { env } from '../config/env.js';
|
||||
import { EventHandler } from '../utils/types';
|
||||
import { logger } from '../utils/logger';
|
||||
import { env } from '../config/env';
|
||||
import { context } from '../config/context';
|
||||
import { settingsStore } from '../config/state';
|
||||
|
||||
const event: EventHandler = {
|
||||
name: 'ready',
|
||||
once: true,
|
||||
execute(client: Client) {
|
||||
logger.info(`Bot eingeloggt als ${client.user?.tag}`);
|
||||
client.user?.setPresence({ activities: [{ name: 'Papo | /help', type: 0 }], status: 'online' });
|
||||
logger.info(`Ready on ${client.guilds.cache.size} Guilds`);
|
||||
async execute(client: Client) {
|
||||
try {
|
||||
logger.info(`Bot eingeloggt als ${client.user?.tag}`);
|
||||
client.user?.setPresence({ activities: [{ name: 'Papo | /help', type: 0 }], status: 'online' });
|
||||
logger.info(`Ready on ${client.guilds.cache.size} Guilds`);
|
||||
// force guild command registration so new commands wie /birthday sofort erscheinen
|
||||
if (context.commandHandler) {
|
||||
for (const [gid] of client.guilds.cache) {
|
||||
await context.commandHandler.registerGuildCommands(gid).catch((err) => logger.warn(`register commands failed for ${gid}: ${err}`));
|
||||
}
|
||||
}
|
||||
context.birthdays.startScheduler();
|
||||
context.birthdays.checkAndSend(true).catch(() => undefined);
|
||||
await context.reactionRoles.loadCache().catch(() => undefined);
|
||||
for (const gid of settingsStore.all().keys()) {
|
||||
context.reactionRoles.resyncGuild(gid).catch((err) => logger.warn(`reaction roles sync failed for ${gid}: ${err}`));
|
||||
}
|
||||
} catch (err) {
|
||||
logger.warn(`Ready handler failed: ${err}`);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user