Skip to content
This repository was archived by the owner on Nov 30, 2022. It is now read-only.

Commit 2460697

Browse files
committed
fix bug cooldown not working 👍
1 parent 79d0f0e commit 2460697

16 files changed

+99
-222
lines changed

Events/Client/error.js

Lines changed: 21 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,29 @@
1-
// //=====================================| Import the Module |=====================================\
1+
//=====================================| Import the Module |=====================================\
22

3-
// const color = require('colors');
3+
const color = require('colors');
44

5-
// //=====================================| Code |=====================================\
5+
//=====================================| Code |=====================================\
66

7-
// module.exports = {
8-
// name: 'error',
9-
// once: true,
7+
module.exports = {
8+
name: 'error',
9+
once: true,
1010

11-
// async execute(error, client) {
12-
// console.log(`${color.bold.red(`[ERROR]`)} ` `${error.message}`.yellow);
13-
// console.log(`${color.bold.red(`[ERROR]`)} ` + `${error.stack}`.yellow);
14-
// }
15-
// }
11+
async execute(error, client) {
12+
console.log(`${color.bold.red(`[ERROR]`)} ` `${error}`.yellow);
13+
}
14+
}
1615

1716

1817

1918

20-
// /**
21-
// /////////////////////////////////////////////////////////////////////
22-
// //// ////
23-
// \\\\ Handlers Coded by GalaXd#9165 \\\\
24-
// //// ////
25-
// \\\\ Work for MGalaCyber Development | https://galacyber.xyz \\\\
26-
// //// ////
27-
// \\\\ All Right Reserved! \\\\
28-
// //// ////
29-
// /////////////////////////////////////////////////////////////////////
30-
// */
19+
/**
20+
/////////////////////////////////////////////////////////////////////
21+
//// ////
22+
\\\\ Handlers Coded by GalaXd#9165 \\\\
23+
//// ////
24+
\\\\ Work for MGalaCyber Development | https://galacyber.xyz \\\\
25+
//// ////
26+
\\\\ All Right Reserved! \\\\
27+
//// ////
28+
/////////////////////////////////////////////////////////////////////
29+
*/

Events/Interaction/interactionButton.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ module.exports = {
4343
.setColor(Embed.Colors.wrongcolor)
4444
.setTitle(`${Emoji.Message.ERROR} Failed To Execute Button!`)
4545
.setDescription(`I cant execute the button for you.`)
46-
.setFooter(`${Embed.footertext} · v${version}`, client.user.displayAvatarURL())
46+
.setFooter({ text: `${Embed.footertext} · v${version}`, iconURL: client.user.displayAvatarURL() })
4747
]
4848
})
4949
}
@@ -59,7 +59,7 @@ module.exports = {
5959
.setColor(Embed.Colors.wrongcolor)
6060
.setTitle(`${Emoji.Message.ERROR} You can't Click This Button!`)
6161
.setDescription(`The button is author only can use this button.`)
62-
.setFooter(`${Embed.footertext} · v${version}`, client.user.displayAvatarURL())
62+
.setFooter({ text: `${Embed.footertext} · v${version}`, iconURL: client.user.displayAvatarURL() })
6363
]
6464
})
6565
}
@@ -77,7 +77,7 @@ module.exports = {
7777
.setDescription(`${Emoji.Message.ERROR} There was an error trying to execute that button!`)
7878
.setDescription(`There was an error trying to execute that button.`)
7979
.addField('Error', `\`\`\`${error}\`\`\``)
80-
.setFooter(`${Embed.footertext} · v${version}`, client.user.displayAvatarURL())
80+
.setFooter({ text: `${Embed.footertext} · v${version}`, iconURL: client.user.displayAvatarURL() })
8181
]
8282
})
8383
}

Events/Interaction/interactionContext.js

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ module.exports = {
4949
.setColor(Embed.Colors.wrongcolor)
5050
.setTitle(`${Emoji.Message.ERROR} You can't use this Command!`)
5151
.setDescription(`The command \`${interaction.commandName}\` can only be used in the official server.`)
52-
.setFooter(`${Embed.footertext} · v${version}`, client.user.displayAvatarURL())
52+
.setFooter({ text: `${Embed.footertext} · v${version}`, iconURL: client.user.displayAvatarURL() })
5353
],
5454
components: [
5555
new ActionRowBuilder().addComponents(
@@ -68,7 +68,7 @@ module.exports = {
6868
.setColor(Embed.Colors.wrongcolor)
6969
.setTitle(`${Emoji.Message.ERROR} You can't use this Command!`)
7070
.setDescription(`The command \`${interaction.commandName}\` has been disabled by the Developer! Please try again later.`)
71-
.setFooter(`${Embed.footertext} · v${version}`, client.user.displayAvatarURL())
71+
.setFooter({ text: `${Embed.footertext} · v${version}`, iconURL: client.user.displayAvatarURL() })
7272
]
7373
})
7474
}
@@ -82,7 +82,7 @@ module.exports = {
8282
.setColor(Embed.Colors.wrongcolor)
8383
.setTitle(`${Emoji.Message.ERROR} You can't use this Command!`)
8484
.setDescription(`The command \`${interaction.commandName}\` has been maintenance, because the command is currently bug fixed! Please try again later.`)
85-
.setFooter(`${Embed.footertext} · v${version}`, client.user.displayAvatarURL())
85+
.setFooter({ text: `${Embed.footertext} · v${version}`, iconURL: client.user.displayAvatarURL() })
8686
]
8787
})
8888
}
@@ -96,7 +96,7 @@ module.exports = {
9696
.setColor(Embed.Colors.wrongcolor)
9797
.setTitle(`${Emoji.Message.ERROR} You can't use this Command!`)
9898
.setDescription(`The command \`${interaction.commandName}\` only can use if you join to the voice! Please join to voice and Please try again later.`)
99-
.setFooter(`${Embed.footertext} · v${version}`, client.user.displayAvatarURL())
99+
.setFooter({ text: `${Embed.footertext} · v${version}`, iconURL: client.user.displayAvatarURL() })
100100
]
101101
})
102102
}
@@ -109,7 +109,7 @@ module.exports = {
109109
new EmbedBuilder()
110110
.setColor(Embed.Colors.wrongcolor)
111111
.setDescription(`${Emoji.Message.ERROR} This command can only be used in NSFW channels!`)
112-
.setFooter(`${Embed.footertext} · v${version}`, client.user.displayAvatarURL())
112+
.setFooter({ text: `${Embed.footertext} · v${version}`, iconURL: client.user.displayAvatarURL() })
113113
]
114114
})
115115
}
@@ -122,7 +122,7 @@ module.exports = {
122122
new EmbedBuilder()
123123
.setColor(Embed.Colors.wrongcolor)
124124
.setDescription(`${Emoji.Message.ERROR} I don't have the required permissions to use this command\n \`${command.botPerms.join(`, `)}\``)
125-
.setFooter(`${Embed.footertext} · v${version}`, client.user.displayAvatarURL())
125+
.setFooter({ text: `${Embed.footertext} · v${version}`, iconURL: client.user.displayAvatarURL() })
126126
]
127127
})
128128
}
@@ -135,21 +135,21 @@ module.exports = {
135135
new EmbedBuilder()
136136
.setColor(Embed.Colors.wrongcolor)
137137
.setDescription(`${Emoji.Message.ERROR} You don't have the required permissions to use this command\n \`${command.userPerms.join(`, `)}\``)
138-
.setFooter(`${Embed.footertext} · v${version}`, client.user.displayAvatarURL())
138+
.setFooter({ text: `${Embed.footertext} · v${version}`, iconURL: client.user.displayAvatarURL() })
139139
]
140140
})
141141
}
142142

143143
// ====================< Cooldown Check InterrorCmdLogsInt=================== \\
144-
if (command.cooldown && onCoolDownInt(interaction, command)) {
144+
if (onCoolDownInt(interaction, command)) {
145145
return interaction.reply({
146146
ephemeral: true,
147147
embeds: [
148148
new EmbedBuilder()
149149
.setColor(Embed.Colors.wrongcolor)
150150
.setTitle(`${Emoji.Message.ERROR} You have been cooldown for \`${command.cooldown}\` seconds!`)
151-
.setDescription(`Please wait \`${onCoolDownInt(interaction, command).toFixed(1)}\` Before using the \`${command.name}\` command again!`)
152-
.setFooter(`${Embed.footertext} · v${version}`, client.user.displayAvatarURL())
151+
.setDescription(`Please wait \`${onCoolDownInt(interaction, command).toFixed(1)}\` Before using the \`${interaction.commandName}\` command again!`)
152+
.setFooter({ text: `${Embed.footertext} · v${version}`, iconURL: client.user.displayAvatarURL() })
153153
]
154154
})
155155
}
@@ -167,7 +167,7 @@ module.exports = {
167167
.setDescription(`${Emoji.Message.ERROR} There was an error trying to execute that command!`)
168168
.setDescription(`There was an error trying to execute that command.`)
169169
.addField('Error', `\`\`\`${error}\`\`\``)
170-
.setFooter(`${Embed.footertext} · v${version}`, client.user.displayAvatarURL())
170+
.setFooter({ text: `${Embed.footertext} · v${version}`, iconURL: client.user.displayAvatarURL() })
171171
]
172172
})
173173
}

Events/Interaction/interactionCreate.js

Lines changed: 26 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
//=====================================| Import the Module |=====================================\
22

3-
const { ChatInputCommandInteraction, EmbedBuilder, ActionRowBuilder, ButtonBuilder, ButtonStyle, Collection, PermissionsBitField, ChannelType } = require('discord.js');
3+
const { CommandInteraction, EmbedBuilder, ActionRowBuilder, ButtonBuilder, ButtonStyle, Collection, PermissionsBitField, ChannelType } = require('discord.js');
44
const { errorCmdLogsInt } = require(`../../Structures/Functions/errorCmdLogs.js`);
55
const { onCoolDownInt } = require(`../../Structures/Functions/onCoolDown.js`);
66
const Settings = require(`../../Structures/Settings/settings.json`);
@@ -18,9 +18,8 @@ module.exports = {
1818

1919
/**
2020
*
21-
* @param {ChatInputCommandInteraction} interaction
21+
* @param {CommandInteraction} interaction
2222
* @param {Client} client
23-
* @returns
2423
*/
2524

2625
async execute(interaction, client) {
@@ -36,7 +35,18 @@ module.exports = {
3635
if (interaction.user.bot) return;
3736

3837
const command = client.slash.get(interaction.commandName);
39-
if (!command) return client.slash.delete(interaction.commandName);
38+
if (!command) {
39+
return interaction.reply({
40+
ephemeral: true,
41+
embeds: [
42+
new EmbedBuilder()
43+
.setColor(Embed.Colors.wrongcolor)
44+
.setTitle(`${Emoji.Message.No} ${interaction.user.username} You have entered an invalid command!`)
45+
.setDescription(`The command \`${interaction.commandName}\` is outdated.\nPlease use \`${prefix}help\` to see all the commands.`)
46+
.setFooter({ text: `${Embed.footertext} · v${version}`, iconURL: client.user.displayAvatarURL() })
47+
]
48+
});
49+
};
4050

4151
const args = [];
4252

@@ -62,7 +72,7 @@ module.exports = {
6272
.setColor(Embed.Colors.wrongcolor)
6373
.setTitle(`${Emoji.Message.ERROR} You can't use this Command!`)
6474
.setDescription(`The command \`${interaction.commandName}\` can only be used by Developer.`)
65-
.setFooter(`${Embed.footertext} · v${version}`, client.user.displayAvatarURL())
75+
.setFooter({ text: `${Embed.footertext} · v${version}`, iconURL: client.user.displayAvatarURL() })
6676
],
6777
components: [
6878
new ActionRowBuilder().addComponents(
@@ -82,7 +92,7 @@ module.exports = {
8292
.setColor(Embed.Colors.wrongcolor)
8393
.setTitle(`${Emoji.Message.ERROR} You can't use this Command!`)
8494
.setDescription(`The command \`${interaction.commandName}\` can only be used in the official server.`)
85-
.setFooter(`${Embed.footertext} · v${version}`, client.user.displayAvatarURL())
95+
.setFooter({ text: `${Embed.footertext} · v${version}`, iconURL: client.user.displayAvatarURL() })
8696
],
8797
components: [
8898
new ActionRowBuilder().addComponents(
@@ -101,7 +111,7 @@ module.exports = {
101111
.setColor(Embed.Colors.wrongcolor)
102112
.setTitle(`${Emoji.Message.ERROR} You can't use this Command!`)
103113
.setDescription(`The command \`${interaction.commandName}\` has been disabled by the Developer! Please try again later.`)
104-
.setFooter(`${Embed.footertext} · v${version}`, client.user.displayAvatarURL())
114+
.setFooter({ text: `${Embed.footertext} · v${version}`, iconURL: client.user.displayAvatarURL() })
105115
]
106116
})
107117
}
@@ -115,7 +125,7 @@ module.exports = {
115125
.setColor(Embed.Colors.wrongcolor)
116126
.setTitle(`${Emoji.Message.ERROR} You can't use this Command!`)
117127
.setDescription(`The command \`${interaction.commandName}\` has been maintenance, because the command is currently bug fixed! Please try again later.`)
118-
.setFooter(`${Embed.footertext} · v${version}`, client.user.displayAvatarURL())
128+
.setFooter({ text: `${Embed.footertext} · v${version}`, iconURL: client.user.displayAvatarURL() })
119129
]
120130
})
121131
}
@@ -129,7 +139,7 @@ module.exports = {
129139
.setColor(Embed.Colors.wrongcolor)
130140
.setTitle(`${Emoji.Message.ERROR} You can't use this Command!`)
131141
.setDescription(`The command \`${interaction.commandName}\` only can use if you join to the voice! Please join to voice and Please try again later.`)
132-
.setFooter(`${Embed.footertext} · v${version}`, client.user.displayAvatarURL())
142+
.setFooter({ text: `${Embed.footertext} · v${version}`, iconURL: client.user.displayAvatarURL() })
133143
]
134144
})
135145
}
@@ -142,7 +152,7 @@ module.exports = {
142152
new EmbedBuilder()
143153
.setColor(Embed.Colors.wrongcolor)
144154
.setDescription(`${Emoji.Message.ERROR} This command can only be used in NSFW channels!`)
145-
.setFooter(`${Embed.footertext} · v${version}`, client.user.displayAvatarURL())
155+
.setFooter({ text: `${Embed.footertext} · v${version}`, iconURL: client.user.displayAvatarURL() })
146156
]
147157
})
148158
}
@@ -155,7 +165,7 @@ module.exports = {
155165
new EmbedBuilder()
156166
.setColor(Embed.Colors.wrongcolor)
157167
.setDescription(`${Emoji.Message.ERROR} I don't have the required permissions to use this command\n \`${command.botPerms.join(`, `)}\``)
158-
.setFooter(`${Embed.footertext} · v${version}`, client.user.displayAvatarURL())
168+
.setFooter({ text: `${Embed.footertext} · v${version}`, iconURL: client.user.displayAvatarURL() })
159169
]
160170
})
161171
}
@@ -168,21 +178,21 @@ module.exports = {
168178
new EmbedBuilder()
169179
.setColor(Embed.Colors.wrongcolor)
170180
.setDescription(`${Emoji.Message.ERROR} You don't have the required permissions to use this command\n \`${command.userPerms.join(`, `)}\``)
171-
.setFooter(`${Embed.footertext} · v${version}`, client.user.displayAvatarURL())
181+
.setFooter({ text: `${Embed.footertext} · v${version}`, iconURL: client.user.displayAvatarURL() })
172182
]
173183
})
174184
}
175185

176186
// ====================< Cooldown Check InterrorCmdLogsInt=================== \\
177-
if (command.cooldown && onCoolDownInt(interaction, command)) {
187+
if (onCoolDownInt(interaction, command)) {
178188
return interaction.reply({
179189
ephemeral: true,
180190
embeds: [
181191
new EmbedBuilder()
182192
.setColor(Embed.Colors.wrongcolor)
183193
.setTitle(`${Emoji.Message.ERROR} You have been cooldown for \`${command.cooldown}\` seconds!`)
184-
.setDescription(`Please wait \`${onCoolDownInt(interaction, command).toFixed(1)}\` Before using the \`${command.name}\` command again!`)
185-
.setFooter(`${Embed.footertext} · v${version}`, client.user.displayAvatarURL())
194+
.setDescription(`Please wait \`${onCoolDownInt(interaction, command).toFixed(1)}\` Before using the \`${interaction.commandName}\` command again!`)
195+
.setFooter({ text: `${Embed.footertext} · v${version}`, iconURL: client.user.displayAvatarURL() })
186196
]
187197
})
188198
}
@@ -200,7 +210,7 @@ module.exports = {
200210
.setDescription(`${Emoji.Message.ERROR} There was an error trying to execute that command!`)
201211
.setDescription(`There was an error trying to execute that command.`)
202212
.addField('Error', `\`\`\`${error}\`\`\``)
203-
.setFooter(`${Embed.footertext} · v${version}`, client.user.displayAvatarURL())
213+
.setFooter({ text: `${Embed.footertext} · v${version}`, iconURL: client.user.displayAvatarURL() })
204214
]
205215
})
206216
}

0 commit comments

Comments
 (0)