This repository was archived by the owner on Sep 8, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.js
More file actions
83 lines (68 loc) · 2.29 KB
/
Copy pathindex.js
File metadata and controls
83 lines (68 loc) · 2.29 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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
const fs = require('fs');
const path = require('path');
process.title = 'Skyrden Core'
const scriptsFolder = './handlers';
const scriptFiles = fs.readdirSync(scriptsFolder).filter(file => file.endsWith('.js'));
scriptFiles.forEach(file => {
const scriptPath = path.join(__dirname, scriptsFolder, file);
require(scriptPath);
});
const { Client, GatewayIntentBits, REST, Collection, Events, Routes, Partials } = require('discord.js');
const { token, mainguildid, staffguildid, supportguildid } = require("./config.json");
global.verifCodes = []
global.client = new Client({intents: [
GatewayIntentBits.Guilds,
GatewayIntentBits.GuildMessages,
GatewayIntentBits.MessageContent,
GatewayIntentBits.DirectMessages,
GatewayIntentBits.DirectMessageTyping
], partials: [Partials.Channel]});
client.login(token);
client.guilds.fetch(mainguildid)
.then(guild => {
global.mainguild = guild;
})
client.guilds.fetch(staffguildid)
.then(guild => {
global.staffguild = guild;
})
client.guilds.fetch(supportguildid)
.then(guild => {
global.supportguild = guild;
})
client.commands = new Collection();
const foldersPath = path.join(__dirname, 'commands');
const commandFolders = fs.readdirSync(foldersPath);
for (const folder of commandFolders) {
const commandsPath = path.join(foldersPath, folder);
const commandFiles = fs.readdirSync(commandsPath).filter(file => file.endsWith('.js'));
for (const file of commandFiles) {
const filePath = path.join(commandsPath, file);
const command = require(filePath);
if ('data' in command && 'execute' in command) {
client.commands.set(command.data.name, command);
} else {
console.log(`[WARNING] The command at ${filePath} is missing a required "data" or "execute" property.`);
}
}
}
const eventsPath = path.join(__dirname, 'events');
const eventFiles = fs.readdirSync(eventsPath).filter(file => file.endsWith('.js'));
for (const file of eventFiles) {
const filePath = path.join(eventsPath, file);
const event = require(filePath);
if (event.once) {
client.once(event.name, (...args) => event.execute(...args));
} else {
client.on(event.name, (...args) => event.execute(...args));
}
}
process.on
(
'uncaughtException',
function (err)
{
console.log(err)
client.channels.cache.get("994709325186600980").send(`\`\`\`${err.toString()}\`\`\``);
}
);