-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathindex.ts
29 lines (24 loc) · 869 Bytes
/
index.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
import {Client, Intents} from 'discord.js';
import {loadPlugins} from './src/command-loader';
import dotenv from 'dotenv';
import {Bot} from './src/bot';
import {BotRepository} from './src/database';
dotenv.config();
async function run() {
const [commands, listeners] = await loadPlugins();
const repository = new BotRepository();
const client = new Client({
intents: [
Intents.FLAGS.GUILDS,
Intents.FLAGS.GUILD_MESSAGES,
Intents.FLAGS.GUILD_MESSAGE_REACTIONS,
Intents.FLAGS.DIRECT_MESSAGES,
]
});
const bot = new Bot(client, commands, process.env.TRIGGER ?? '!', repository);
bot.addListeners(listeners);
client.on('ready', bot.onReady.bind(bot));
client.on('messageCreate', bot.onMessageCreate.bind(bot));
await client.login(process.env.DISCORD_TOKEN);
}
run();