1
0
Fork 0
This repository has been archived on 2024-07-14. You can view files and clone it, but cannot push or open issues or pull requests.
Ellie-bot/src/index.ts

28 lines
981 B
TypeScript
Raw Normal View History

2022-01-05 16:50:41 -08:00
require('dotenv').config();
2022-01-13 02:21:37 -08:00
import 'reflect-metadata';
2022-01-05 16:50:41 -08:00
import { registerCommands, registerEvents } from './utils/registry';
import config from '../slappey.json';
import DiscordClient from './client/client';
import { Intents } from 'discord.js';
2022-01-13 02:21:37 -08:00
import { createConnection } from 'typeorm';
import { GuildConfiguration } from './typeorm/entities/GuildConfiguration';
2022-01-05 16:50:41 -08:00
const client = new DiscordClient({ intents: [Intents.FLAGS.GUILDS, Intents.FLAGS.GUILD_MESSAGES ] });
(async () => {
2022-01-13 02:21:37 -08:00
await createConnection({
type: 'mysql',
host: process.env.MYSQL_DB_HOST,
port: 3306,
username: process.env.MYSQL_DB_USERNAME,
password: process.env.MYSQL_DB_PASSWORD,
database: process.env.MYSQL_DB_DATABASE,
synchronize: true,
entities: [GuildConfiguration]
});
2022-01-05 16:50:41 -08:00
client.prefix = config.prefix || client.prefix;
await registerCommands(client, '../commands');
await registerEvents(client, '../events');
await client.login(process.env.DJS_BOT_TOKEN);
})();