-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathindex.js
More file actions
44 lines (35 loc) · 1.18 KB
/
index.js
File metadata and controls
44 lines (35 loc) · 1.18 KB
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
const discord = require('discord.js');
const { Logger } = require('./util/Logger');
require('dotenv').config();
const commands = require('./util/commands'); // List of commands
const TOKEN = process.env.DISCORD_TOKEN;
const client = new discord.Client({
intents: []
})
client.commands = new discord.Collection();
for (const key in commands) {
const command = commands[key];
client.commands.set(command.data.name, command);
}
// Register command interaction handler
client.on('interactionCreate', async interaction => {
if (!interaction.isCommand()) return;
const command = client.commands.get(interaction.commandName);
if (!command) return;
try {
await command.execute(interaction);
} catch (error) {
Logger.error('Error executing command:', error);
await interaction.reply({ content: 'There was an error while executing this command!', ephemeral: true });
}
});
client.once('ready', () => {
Logger.info(`Logged in as ${client.user.tag}!`);
// Set rich presence status
client.user.setActivity({
name: "Playing PluginWizard"
});
});
client.login(TOKEN).catch(err => {
Logger.error('Failed to login:', err);
})