-
Notifications
You must be signed in to change notification settings - Fork 1
/
index.js
27 lines (25 loc) · 879 Bytes
/
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
const { Client, GatewayIntentBits, Partials, ActionRowBuilder, ButtonBuilder, ButtonStyle, Events } = require('discord.js')
const { CommandHandler } = require('djs-commands')
const client = new Client({
intents: [
GatewayIntentBits.Guilds,
GatewayIntentBits.GuildIntegrations,
GatewayIntentBits.GuildMembers,
],
partials: [Partials.GuildMember, Partials.Channel],
});
const CH = new CommandHandler({
folder: __dirname + '/commands/',
globalCommandRefresh: true, //not including this or setting as false reverts to not updating commands.
});
client.on('interactionCreate', async (interaction) => {
if (!interaction.isChatInputCommand()) return;
let cmd = CH.getCommand(interaction.commandName);
if (!cmd) return;
try {
cmd.run(interaction);
} catch (e) {
console.log(e);
}
});
client.login(process.env.TOKEN)