Botanique/src/index.ts

41 lines
1,011 B
TypeScript
Raw Normal View History

import loadClient from './utils/client';
import loadEvents from './events/loader';
import loadCommands from './commands/loader';
const run = async () => {
console.log('Starting Botanique...');
// Load .env if not in prod
if (process.env.NODE_ENV !== 'production') {
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore
(await import('dotenv')).config({ path: './config/.env' });
}
// Client Discord.JS
await loadClient()
.then(async client => {
console.log('Client ✅');
await loadEvents(client)
.then(() => console.log('Events ✅'))
.catch(() => {
throw 'Events ❌';
});
await client.login(client.config.token_discord);
await loadCommands(client)
.then(() => console.log('Commands ✅'))
.catch(() => {
throw 'Commands ❌';
});
console.log(`Botanique "${client.user?.username}" ${client.config.version} started!`);
})
.catch(() => {
throw 'Client ❌';
});
};
run().catch(error => console.error(error));