Initial commit of karuta-starboard bot
This commit is contained in:
@@ -0,0 +1,38 @@
|
||||
const { Client, GatewayIntentBits, Collection, Partials } = require('discord.js');
|
||||
const fs = require('fs');
|
||||
const path = require('path');
|
||||
require('dotenv').config();
|
||||
|
||||
const client = new Client({
|
||||
intents: [
|
||||
GatewayIntentBits.Guilds,
|
||||
GatewayIntentBits.GuildMessages,
|
||||
GatewayIntentBits.MessageContent,
|
||||
GatewayIntentBits.GuildMessageReactions
|
||||
],
|
||||
partials: [Partials.Message, Partials.Channel, Partials.Reaction]
|
||||
});
|
||||
|
||||
client.commands = new Collection();
|
||||
|
||||
// Load commands
|
||||
const commandsPath = path.join(__dirname, 'SlashCommands');
|
||||
const commandFiles = fs.readdirSync(commandsPath).filter(file => file.endsWith('.js'));
|
||||
for (const file of commandFiles) {
|
||||
const command = require(path.join(commandsPath, file));
|
||||
client.commands.set(command.data.name, command);
|
||||
}
|
||||
|
||||
// Load events
|
||||
const eventsPath = path.join(__dirname, 'events');
|
||||
const eventFiles = fs.readdirSync(eventsPath).filter(file => file.endsWith('.js'));
|
||||
for (const file of eventFiles) {
|
||||
const event = require(path.join(eventsPath, file));
|
||||
if (event.once) {
|
||||
client.once(event.name, (...args) => event.execute(...args, client));
|
||||
} else {
|
||||
client.on(event.name, (...args) => event.execute(...args, client));
|
||||
}
|
||||
}
|
||||
|
||||
client.login(process.env.TOKEN);
|
||||
Reference in New Issue
Block a user