2022-11-09 14:44:05 +01:00
|
|
|
const fs = require('fs');
|
|
|
|
const { Client, GatewayIntentBits } = require("discord.js");
|
2023-09-04 00:30:25 +02:00
|
|
|
const { token } = require('./config.json');
|
2023-09-04 10:51:57 +02:00
|
|
|
const { deploy_commands, loadDatabase, loadErrorCatcher } = require('./functions.js');
|
2022-11-09 14:44:05 +01:00
|
|
|
|
|
|
|
const client = new Client({
|
|
|
|
intents: [
|
|
|
|
GatewayIntentBits.Guilds,
|
|
|
|
GatewayIntentBits.GuildMembers,
|
2023-09-04 00:26:13 +02:00
|
|
|
GatewayIntentBits.GuildModeration,
|
2022-11-09 14:44:05 +01:00
|
|
|
GatewayIntentBits.GuildMessages
|
|
|
|
]
|
|
|
|
});
|
|
|
|
|
2023-09-04 10:51:57 +02:00
|
|
|
loadDatabase(client);
|
|
|
|
loadErrorCatcher(client);
|
2022-11-09 14:44:05 +01:00
|
|
|
|
|
|
|
const eventFiles = fs.readdirSync('./events').filter(file => file.endsWith('.js'));
|
|
|
|
for (const file of eventFiles) {
|
|
|
|
const event = require(`./events/${file}`);
|
|
|
|
if (event.once) {
|
|
|
|
client.once(event.name, (...args) => event.execute(...args, client));
|
|
|
|
} else {
|
|
|
|
client.on(event.name, (...args) => event.execute(...args, client));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2023-04-24 20:38:45 +02:00
|
|
|
deploy_commands(client, true);
|
|
|
|
/*
|
2023-04-24 20:45:36 +02:00
|
|
|
true will refresh slash commands (SET endpoint)
|
|
|
|
false will delete them (SET endpoint with an empty array)
|
|
|
|
null will not change slash commands
|
2023-04-24 20:38:45 +02:00
|
|
|
*/
|
2022-11-09 14:44:05 +01:00
|
|
|
|
|
|
|
|
2023-04-24 20:38:45 +02:00
|
|
|
client.login(token);
|