Skip to content

Commit a66fd6a

Browse files
committed
Update v10.0.0
➕ add .gitignore files ➕ add new client files ➕ add new folder & files functions ➕ add new cooldown on Message & Slash Commands ➕ add new Permissions Nsfw Only on Message & Slash Commands ➕ add new permissions Bot/User on Message & Slash Commands ➖ remove Package-lock.json files 🛠 update Packages 🛠 update Folder name 🛠 update Structures folder files 🛠 update Structures script 🛠 update Slash Commands script code 🛠 update script index.js 👾 Fix antiCrash handler 👾 Fix Events handler (pull.bind error) 👾 Fix bug
1 parent 9e96655 commit a66fd6a

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

41 files changed

+820
-1433
lines changed
Lines changed: 139 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,139 @@
1+
//=====================================| Import the Module |=====================================\
2+
3+
const { MessageEmbed, MessageActionRow, MessageButton, MessageSelectMenu, MessageAttachment, InteractionCreate } = require('discord.js');
4+
const { errorCmdLogs2 } = require(`${process.cwd()}/Functions/errorCmdLogs.js`);
5+
const { onCoolDown2 } = require(`${process.cwd()}/Functions/onCoolDown.js`);
6+
const { author, version } = require(`${process.cwd()}/package.json`);
7+
const Settings = require(`${process.cwd()}/Settings/settings.json`);
8+
const Config = require(`${process.cwd()}/Settings/config.json`);
9+
const Emoji = require(`${process.cwd()}/Settings/emojis.json`);
10+
const Embed = require(`${process.cwd()}/Settings/embed.json`);
11+
12+
/**
13+
*
14+
* @param {Client} client
15+
* @param {InteractionCreate} interaction
16+
*/
17+
18+
//=====================================| Code |=====================================\
19+
20+
module.exports = async (client, interaction) => {
21+
try {
22+
//=====================================| Command Handling |=====================================\\
23+
if (interaction.isCommand()) {
24+
const command = client.slashCommands.get(interaction.commandName);
25+
if (!command) return interaction.reply({
26+
ephemeral: true,
27+
embeds: [
28+
new MessageEmbed()
29+
.setColor(Embed.wrongcolor)
30+
.setDescription(`${Emoji.Message.ERROR} The command \`${interaction.commandName}\` doesn't exist!`)
31+
.setFooter(`${Embed.footertext} · v${version}`, client.user.displayAvatarURL())
32+
]
33+
}).catch(() => null);
34+
35+
const args = [];
36+
37+
for (let option of interaction.options.data) {
38+
if (option.type === 'SUB_COMMAND') {
39+
if (option.name) args.push(option.name);
40+
option.options?.forEach((x) => {
41+
if (x.value) args.push(x.value);
42+
});
43+
} else if (option.value) args.push(option.value);
44+
}
45+
interaction.member = interaction.guild.members.cache.get(interaction.user.id) || await interaction.guild.members.fetch(interaction.user.id).catch(() => null);
46+
47+
// ========================================| Other list Handler |======================================= \\
48+
49+
// ====================< NSFW only Check >=================== \\
50+
if (command.nsfwOnly && !interaction.channel.nsfw) {
51+
return interaction.reply({
52+
ephemeral: true,
53+
embeds: [
54+
new MessageEmbed()
55+
.setColor(Embed.wrongcolor)
56+
.setDescription(`${Emoji.Message.ERROR} This command can only be used in NSFW channels!`)
57+
.setFooter(`${Embed.footertext} · v${version}`, client.user.displayAvatarURL())
58+
]
59+
})
60+
}
61+
62+
// ====================< Bots Permissions Check >=================== \\
63+
if (command.botPerms && !interaction.member.permissions.has(command.botPerms)) {
64+
return interaction.reply({
65+
ephemeral: true,
66+
embeds: [
67+
new MessageEmbed()
68+
.setColor(Embed.wrongcolor)
69+
.setDescription(`${Emoji.Message.ERROR} I don't have the required permissions to use this command\n \`${command.botPerms.join(`, `)}\``)
70+
.setFooter(`${Embed.footertext} · v${version}`, client.user.displayAvatarURL())
71+
]
72+
})
73+
}
74+
75+
// ====================< Members Permissions Check >=================== \\
76+
if (command.userPerms && !interaction.member.permissions.has(command.userPerms)) {
77+
return interaction.reply({
78+
ephemeral: true,
79+
embeds: [
80+
new MessageEmbed()
81+
.setColor(Embed.wrongcolor)
82+
.setDescription(`${Emoji.Message.ERROR} You don't have the required permissions to use this command\n \`${command.userPerms.join(`, `)}\``)
83+
.setFooter(`${Embed.footertext} · v${version}`, client.user.displayAvatarURL())
84+
]
85+
})
86+
}
87+
88+
// ====================< Cooldown Check >=================== \\
89+
if (command.cooldown && onCoolDown2(interaction, command)) {
90+
return interaction.reply({
91+
ephemeral: true,
92+
embeds: [
93+
new MessageEmbed()
94+
.setColor(Embed.wrongcolor)
95+
.setTitle(`${Emoji.Message.ERROR} You have been cooldown for \`${command.cooldown}\` seconds!`)
96+
.setDescription(`Please wait \`${onCoolDown2(interaction, command).toFixed(1)}\` Before using the \`${command.name}\` command again!`)
97+
.setFooter(`${Embed.footertext} · v${version}`, client.user.displayAvatarURL())
98+
]
99+
})
100+
}
101+
102+
// ====================< Start Command >=================== \\
103+
try {
104+
command.run(client, interaction, args, '/');
105+
} catch (error) {
106+
console.log(error);
107+
return interaction.reply({
108+
ephemeral: true,
109+
embeds: [
110+
new MessageEmbed()
111+
.setColor(Embed.wrongcolor)
112+
.setDescription(`${Emoji.Message.ERROR} There was an error trying to execute that command!`)
113+
.setDescription(`There was an error trying to execute that command.`)
114+
.addField('Error', `\`\`\`${error}\`\`\``)
115+
.setFooter(`${Embed.footertext} · v${version}`, client.user.displayAvatarURL())
116+
]
117+
})
118+
}
119+
}
120+
121+
} catch (error) {
122+
errorCmdLogs2(client, interaction, error);
123+
}
124+
}
125+
126+
127+
128+
129+
/**
130+
/////////////////////////////////////////////////////////////////////
131+
//// ////
132+
\\\\ Handlers Coded by GalaXd#9165 \\\\
133+
//// ////
134+
\\\\ Work for MGalaCyber Development | https://galacyber.xyz \\\\
135+
//// ////
136+
\\\\ All Right Reserved! \\\\
137+
//// ////
138+
/////////////////////////////////////////////////////////////////////
139+
*/
Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,29 @@
11
//=====================================| Import the Module |=====================================\\
22

3-
const colors = require('colors');
4-
const { readdirSync } = require('fs');
3+
const { readdirSync, read } = require('fs');
4+
require('colors')
55

6-
// ========================================| Anti Crash System Script |======================================= \\
6+
// ========================================| Code |======================================= \\
77

88
module.exports = async (client) => {
9-
const commandFolders = readdirSync(`${process.cwd()}/commands`);
9+
const commandFolders = readdirSync(`${process.cwd()}/MessageCommands`);
1010
for (const folder of commandFolders) {
11-
const commandFiles = readdirSync(`${process.cwd()}/commands/${folder}/`).filter(file => file.endsWith('.js'));
11+
const commandFiles = readdirSync(`${process.cwd()}/MessageCommands/${folder}/`).filter(file => file.endsWith('.js'));
1212
for (const file of commandFiles) {
13-
const command = require(`${process.cwd()}/commands/${folder}/${file}`);
13+
const command = require(`${process.cwd()}/MessageCommands/${folder}/${file}`);
1414
client.commands.set(command.name, command);
1515
}
16-
console.log(`[NORMAL COMMANDS] `.bold.green + `[${commandFiles.length}] `.cyan + `in `.yellow + `${folder} `.magenta + `was loaded!`.yellow);
17-
}
18-
}
16+
console.log(`[MESSAGE COMMANDS] `.bold.green + `[${commandFiles.length}] `.cyan + `in `.yellow + `${folder} `.magenta + `was loaded!`.yellow);
17+
};
18+
};
19+
20+
1921

2022

2123
/**
2224
/////////////////////////////////////////////////////////////////////
2325
//// ////
24-
\\\\ Bot Coded by GalaXd#9165 \\\\
26+
\\\\ Handlers Coded by GalaXd#9165 \\\\
2527
//// ////
2628
\\\\ Work for MGalaCyber Development | https://galacyber.xyz \\\\
2729
//// ////

0 commit comments

Comments
 (0)