-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.ts
30 lines (24 loc) · 1020 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
30
import { client } from "./config/config";
import { registerSlashCommand } from "./command/slash.deploy";
import { connectDB } from "./connect.db";
import ctfCommand from "./command/ctf.command";
import colors from 'colors';
require('dotenv').config();
try {
connectDB();
client.on("guildCreate", guild => {
const idGuild = guild.id;
registerSlashCommand(idGuild);
console.log(colors.green(`[+] Bot joined guild: ${guild.name}, with ID: ${idGuild}`));
})
client.once('ready', () => {
client.guilds.cache.forEach(guild => {
registerSlashCommand(guild.id)
});
console.log(colors.green('[+] Bot is Ready!'));
});
ctfCommand.command(client);
client.login(process.env.TOKEN_BOT).then((data: string) => console.log(colors.green("[+] Server is Connected!"))).catch((err: string) => { console.log(colors.red("[-] Cannot connect to server")); console.log(err); });
} catch (error) {
console.log(colors.red("[-] Error: " + error));
}