Program Commit

This commit is contained in:
2025-10-02 17:31:49 -04:00
parent fd73be0efd
commit 1341b325ee
39 changed files with 21396 additions and 0 deletions

34
discord-bot/index.js Normal file
View File

@@ -0,0 +1,34 @@
const { Client, GatewayIntentBits, Collection } = require('discord.js');
const fs = require('fs');
const path = require('path');
const client = new Client({ intents: [GatewayIntentBits.Guilds] });
client.commands = new Collection();
const commandHandler = require('./handlers/command-handler');
const eventHandler = require('./handlers/event-handler');
commandHandler(client);
eventHandler(client);
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) {
console.error(error);
await interaction.reply({ content: 'There was an error while executing this command!', ephemeral: true });
}
});
const login = () => {
client.login(process.env.DISCORD_BOT_TOKEN);
}
module.exports = { login, client };