-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.js
58 lines (49 loc) · 1.35 KB
/
index.js
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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
/**
* Imports
*/
import { REST, Routes, Client, GatewayIntentBits } from "discord.js";
import path, { dirname } from 'path';
import { fileURLToPath } from 'url';
import dotenv from "dotenv";
import Logger from "./src/utils/logger.js";
import EventManager from "./src/events/manager.js";
import CommandManager from "./src/commands/manager.js";
/**
* Load Env
*/
dotenv.config();
/**
* Constants
*/
const TOKEN = process.env.DISCORD_TOKEN;
const CLIENT_ID = process.env.DISCORD_CLIENT_ID;
const __dirname = dirname(fileURLToPath(import.meta.url));
/**
* Command Manager
*/
const commandManager = new CommandManager();
/**
* Create Interactions
*/
const rest = new REST({ version: "10" }).setToken(TOKEN);
try {
Logger.info('Started refreshing application (/) commands.');
await rest.put(Routes.applicationCommands(CLIENT_ID), { body: commandManager.getCommands() });
Logger.done('Successfully reloaded application (/) commands.')
} catch (error) {
Logger.error(error);
throw error;
}
/**
* Create Client
*/
const client = new Client({ intents: [GatewayIntentBits.Guilds, GatewayIntentBits.GuildMembers, GatewayIntentBits.GuildMessages, GatewayIntentBits.MessageContent, GatewayIntentBits.DirectMessages] });
client.commandManager = commandManager;
/**
* Event Manager
*/
EventManager(client);
/**
* Start Client
*/
client.login(TOKEN);