import { Client, GatewayIntentBits } from 'discord.js'; import { Dependencies, Sern, single, Singleton, DefaultLogging, } from '@sern/handler'; import 'dotenv/config'; const client = new Client({ intents: [ GatewayIntentBits.Guilds, GatewayIntentBits.GuildMembers, GatewayIntentBits.GuildMessages, GatewayIntentBits.MessageContent, ], }); interface MyDependencies extends Dependencies { '@sern/client': Singleton; '@sern/logger': Singleton; } export const useContainer = Sern.makeDependencies({ build: (root) => root .add({ '@sern/client': single(() => client) }) .upsert({ '@sern/logger': single(() => new DefaultLogging()) }), }); Sern.init({ commands: 'dist/commands', events: 'dist/events', containerConfig: { get: useContainer, }, }); client.on('ready', () => console.log('Ready!')) client.login(process.env.TOKEN);