import { Guild } from 'discord.js';
import { EventHandler } from '../utils/types';
import { context } from '../config/context';
import { logger } from '../utils/logger';

const event: EventHandler = {
  name: 'guildCreate',
  async execute(guild: Guild) {
    logger.info(`Joined new guild: ${guild.name} (${guild.id})`);
    if (context.commandHandler) {
      await context.commandHandler.registerGuildCommands(guild.id);
    }
  }
};

export default event;
