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

Commit

Permalink
fix bug cooldown not working 👍
Browse files Browse the repository at this point in the history
  • Loading branch information
MGalaCyber committed Sep 21, 2022
1 parent 79d0f0e commit 2460697
Show file tree
Hide file tree
Showing 16 changed files with 99 additions and 222 deletions.
43 changes: 21 additions & 22 deletions Events/Client/error.js
Original file line number Diff line number Diff line change
@@ -1,30 +1,29 @@
// //=====================================| Import the Module |=====================================\
//=====================================| Import the Module |=====================================\

// const color = require('colors');
const color = require('colors');

// //=====================================| Code |=====================================\
//=====================================| Code |=====================================\

// module.exports = {
// name: 'error',
// once: true,
module.exports = {
name: 'error',
once: true,

// async execute(error, client) {
// console.log(`${color.bold.red(`[ERROR]`)} ` `${error.message}`.yellow);
// console.log(`${color.bold.red(`[ERROR]`)} ` + `${error.stack}`.yellow);
// }
// }
async execute(error, client) {
console.log(`${color.bold.red(`[ERROR]`)} ` `${error}`.yellow);
}
}




// /**
// /////////////////////////////////////////////////////////////////////
// //// ////
// \\\\ Handlers Coded by GalaXd#9165 \\\\
// //// ////
// \\\\ Work for MGalaCyber Development | https://galacyber.xyz \\\\
// //// ////
// \\\\ All Right Reserved! \\\\
// //// ////
// /////////////////////////////////////////////////////////////////////
// */
/**
/////////////////////////////////////////////////////////////////////
//// ////
\\\\ Handlers Coded by GalaXd#9165 \\\\
//// ////
\\\\ Work for MGalaCyber Development | https://galacyber.xyz \\\\
//// ////
\\\\ All Right Reserved! \\\\
//// ////
/////////////////////////////////////////////////////////////////////
*/
6 changes: 3 additions & 3 deletions Events/Interaction/interactionButton.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ module.exports = {
.setColor(Embed.Colors.wrongcolor)
.setTitle(`${Emoji.Message.ERROR} Failed To Execute Button!`)
.setDescription(`I cant execute the button for you.`)
.setFooter(`${Embed.footertext} · v${version}`, client.user.displayAvatarURL())
.setFooter({ text: `${Embed.footertext} · v${version}`, iconURL: client.user.displayAvatarURL() })
]
})
}
Expand All @@ -59,7 +59,7 @@ module.exports = {
.setColor(Embed.Colors.wrongcolor)
.setTitle(`${Emoji.Message.ERROR} You can't Click This Button!`)
.setDescription(`The button is author only can use this button.`)
.setFooter(`${Embed.footertext} · v${version}`, client.user.displayAvatarURL())
.setFooter({ text: `${Embed.footertext} · v${version}`, iconURL: client.user.displayAvatarURL() })
]
})
}
Expand All @@ -77,7 +77,7 @@ module.exports = {
.setDescription(`${Emoji.Message.ERROR} There was an error trying to execute that button!`)
.setDescription(`There was an error trying to execute that button.`)
.addField('Error', `\`\`\`${error}\`\`\``)
.setFooter(`${Embed.footertext} · v${version}`, client.user.displayAvatarURL())
.setFooter({ text: `${Embed.footertext} · v${version}`, iconURL: client.user.displayAvatarURL() })
]
})
}
Expand Down
22 changes: 11 additions & 11 deletions Events/Interaction/interactionContext.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ module.exports = {
.setColor(Embed.Colors.wrongcolor)
.setTitle(`${Emoji.Message.ERROR} You can't use this Command!`)
.setDescription(`The command \`${interaction.commandName}\` can only be used in the official server.`)
.setFooter(`${Embed.footertext} · v${version}`, client.user.displayAvatarURL())
.setFooter({ text: `${Embed.footertext} · v${version}`, iconURL: client.user.displayAvatarURL() })
],
components: [
new ActionRowBuilder().addComponents(
Expand All @@ -68,7 +68,7 @@ module.exports = {
.setColor(Embed.Colors.wrongcolor)
.setTitle(`${Emoji.Message.ERROR} You can't use this Command!`)
.setDescription(`The command \`${interaction.commandName}\` has been disabled by the Developer! Please try again later.`)
.setFooter(`${Embed.footertext} · v${version}`, client.user.displayAvatarURL())
.setFooter({ text: `${Embed.footertext} · v${version}`, iconURL: client.user.displayAvatarURL() })
]
})
}
Expand All @@ -82,7 +82,7 @@ module.exports = {
.setColor(Embed.Colors.wrongcolor)
.setTitle(`${Emoji.Message.ERROR} You can't use this Command!`)
.setDescription(`The command \`${interaction.commandName}\` has been maintenance, because the command is currently bug fixed! Please try again later.`)
.setFooter(`${Embed.footertext} · v${version}`, client.user.displayAvatarURL())
.setFooter({ text: `${Embed.footertext} · v${version}`, iconURL: client.user.displayAvatarURL() })
]
})
}
Expand All @@ -96,7 +96,7 @@ module.exports = {
.setColor(Embed.Colors.wrongcolor)
.setTitle(`${Emoji.Message.ERROR} You can't use this Command!`)
.setDescription(`The command \`${interaction.commandName}\` only can use if you join to the voice! Please join to voice and Please try again later.`)
.setFooter(`${Embed.footertext} · v${version}`, client.user.displayAvatarURL())
.setFooter({ text: `${Embed.footertext} · v${version}`, iconURL: client.user.displayAvatarURL() })
]
})
}
Expand All @@ -109,7 +109,7 @@ module.exports = {
new EmbedBuilder()
.setColor(Embed.Colors.wrongcolor)
.setDescription(`${Emoji.Message.ERROR} This command can only be used in NSFW channels!`)
.setFooter(`${Embed.footertext} · v${version}`, client.user.displayAvatarURL())
.setFooter({ text: `${Embed.footertext} · v${version}`, iconURL: client.user.displayAvatarURL() })
]
})
}
Expand All @@ -122,7 +122,7 @@ module.exports = {
new EmbedBuilder()
.setColor(Embed.Colors.wrongcolor)
.setDescription(`${Emoji.Message.ERROR} I don't have the required permissions to use this command\n \`${command.botPerms.join(`, `)}\``)
.setFooter(`${Embed.footertext} · v${version}`, client.user.displayAvatarURL())
.setFooter({ text: `${Embed.footertext} · v${version}`, iconURL: client.user.displayAvatarURL() })
]
})
}
Expand All @@ -135,21 +135,21 @@ module.exports = {
new EmbedBuilder()
.setColor(Embed.Colors.wrongcolor)
.setDescription(`${Emoji.Message.ERROR} You don't have the required permissions to use this command\n \`${command.userPerms.join(`, `)}\``)
.setFooter(`${Embed.footertext} · v${version}`, client.user.displayAvatarURL())
.setFooter({ text: `${Embed.footertext} · v${version}`, iconURL: client.user.displayAvatarURL() })
]
})
}

// ====================< Cooldown Check InterrorCmdLogsInt=================== \\
if (command.cooldown && onCoolDownInt(interaction, command)) {
if (onCoolDownInt(interaction, command)) {
return interaction.reply({
ephemeral: true,
embeds: [
new EmbedBuilder()
.setColor(Embed.Colors.wrongcolor)
.setTitle(`${Emoji.Message.ERROR} You have been cooldown for \`${command.cooldown}\` seconds!`)
.setDescription(`Please wait \`${onCoolDownInt(interaction, command).toFixed(1)}\` Before using the \`${command.name}\` command again!`)
.setFooter(`${Embed.footertext} · v${version}`, client.user.displayAvatarURL())
.setDescription(`Please wait \`${onCoolDownInt(interaction, command).toFixed(1)}\` Before using the \`${interaction.commandName}\` command again!`)
.setFooter({ text: `${Embed.footertext} · v${version}`, iconURL: client.user.displayAvatarURL() })
]
})
}
Expand All @@ -167,7 +167,7 @@ module.exports = {
.setDescription(`${Emoji.Message.ERROR} There was an error trying to execute that command!`)
.setDescription(`There was an error trying to execute that command.`)
.addField('Error', `\`\`\`${error}\`\`\``)
.setFooter(`${Embed.footertext} · v${version}`, client.user.displayAvatarURL())
.setFooter({ text: `${Embed.footertext} · v${version}`, iconURL: client.user.displayAvatarURL() })
]
})
}
Expand Down
42 changes: 26 additions & 16 deletions Events/Interaction/interactionCreate.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
//=====================================| Import the Module |=====================================\

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

/**
*
* @param {ChatInputCommandInteraction} interaction
* @param {CommandInteraction} interaction
* @param {Client} client
* @returns
*/

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

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

const args = [];

Expand All @@ -62,7 +72,7 @@ module.exports = {
.setColor(Embed.Colors.wrongcolor)
.setTitle(`${Emoji.Message.ERROR} You can't use this Command!`)
.setDescription(`The command \`${interaction.commandName}\` can only be used by Developer.`)
.setFooter(`${Embed.footertext} · v${version}`, client.user.displayAvatarURL())
.setFooter({ text: `${Embed.footertext} · v${version}`, iconURL: client.user.displayAvatarURL() })
],
components: [
new ActionRowBuilder().addComponents(
Expand All @@ -82,7 +92,7 @@ module.exports = {
.setColor(Embed.Colors.wrongcolor)
.setTitle(`${Emoji.Message.ERROR} You can't use this Command!`)
.setDescription(`The command \`${interaction.commandName}\` can only be used in the official server.`)
.setFooter(`${Embed.footertext} · v${version}`, client.user.displayAvatarURL())
.setFooter({ text: `${Embed.footertext} · v${version}`, iconURL: client.user.displayAvatarURL() })
],
components: [
new ActionRowBuilder().addComponents(
Expand All @@ -101,7 +111,7 @@ module.exports = {
.setColor(Embed.Colors.wrongcolor)
.setTitle(`${Emoji.Message.ERROR} You can't use this Command!`)
.setDescription(`The command \`${interaction.commandName}\` has been disabled by the Developer! Please try again later.`)
.setFooter(`${Embed.footertext} · v${version}`, client.user.displayAvatarURL())
.setFooter({ text: `${Embed.footertext} · v${version}`, iconURL: client.user.displayAvatarURL() })
]
})
}
Expand All @@ -115,7 +125,7 @@ module.exports = {
.setColor(Embed.Colors.wrongcolor)
.setTitle(`${Emoji.Message.ERROR} You can't use this Command!`)
.setDescription(`The command \`${interaction.commandName}\` has been maintenance, because the command is currently bug fixed! Please try again later.`)
.setFooter(`${Embed.footertext} · v${version}`, client.user.displayAvatarURL())
.setFooter({ text: `${Embed.footertext} · v${version}`, iconURL: client.user.displayAvatarURL() })
]
})
}
Expand All @@ -129,7 +139,7 @@ module.exports = {
.setColor(Embed.Colors.wrongcolor)
.setTitle(`${Emoji.Message.ERROR} You can't use this Command!`)
.setDescription(`The command \`${interaction.commandName}\` only can use if you join to the voice! Please join to voice and Please try again later.`)
.setFooter(`${Embed.footertext} · v${version}`, client.user.displayAvatarURL())
.setFooter({ text: `${Embed.footertext} · v${version}`, iconURL: client.user.displayAvatarURL() })
]
})
}
Expand All @@ -142,7 +152,7 @@ module.exports = {
new EmbedBuilder()
.setColor(Embed.Colors.wrongcolor)
.setDescription(`${Emoji.Message.ERROR} This command can only be used in NSFW channels!`)
.setFooter(`${Embed.footertext} · v${version}`, client.user.displayAvatarURL())
.setFooter({ text: `${Embed.footertext} · v${version}`, iconURL: client.user.displayAvatarURL() })
]
})
}
Expand All @@ -155,7 +165,7 @@ module.exports = {
new EmbedBuilder()
.setColor(Embed.Colors.wrongcolor)
.setDescription(`${Emoji.Message.ERROR} I don't have the required permissions to use this command\n \`${command.botPerms.join(`, `)}\``)
.setFooter(`${Embed.footertext} · v${version}`, client.user.displayAvatarURL())
.setFooter({ text: `${Embed.footertext} · v${version}`, iconURL: client.user.displayAvatarURL() })
]
})
}
Expand All @@ -168,21 +178,21 @@ module.exports = {
new EmbedBuilder()
.setColor(Embed.Colors.wrongcolor)
.setDescription(`${Emoji.Message.ERROR} You don't have the required permissions to use this command\n \`${command.userPerms.join(`, `)}\``)
.setFooter(`${Embed.footertext} · v${version}`, client.user.displayAvatarURL())
.setFooter({ text: `${Embed.footertext} · v${version}`, iconURL: client.user.displayAvatarURL() })
]
})
}

// ====================< Cooldown Check InterrorCmdLogsInt=================== \\
if (command.cooldown && onCoolDownInt(interaction, command)) {
if (onCoolDownInt(interaction, command)) {
return interaction.reply({
ephemeral: true,
embeds: [
new EmbedBuilder()
.setColor(Embed.Colors.wrongcolor)
.setTitle(`${Emoji.Message.ERROR} You have been cooldown for \`${command.cooldown}\` seconds!`)
.setDescription(`Please wait \`${onCoolDownInt(interaction, command).toFixed(1)}\` Before using the \`${command.name}\` command again!`)
.setFooter(`${Embed.footertext} · v${version}`, client.user.displayAvatarURL())
.setDescription(`Please wait \`${onCoolDownInt(interaction, command).toFixed(1)}\` Before using the \`${interaction.commandName}\` command again!`)
.setFooter({ text: `${Embed.footertext} · v${version}`, iconURL: client.user.displayAvatarURL() })
]
})
}
Expand All @@ -200,7 +210,7 @@ module.exports = {
.setDescription(`${Emoji.Message.ERROR} There was an error trying to execute that command!`)
.setDescription(`There was an error trying to execute that command.`)
.addField('Error', `\`\`\`${error}\`\`\``)
.setFooter(`${Embed.footertext} · v${version}`, client.user.displayAvatarURL())
.setFooter({ text: `${Embed.footertext} · v${version}`, iconURL: client.user.displayAvatarURL() })
]
})
}
Expand Down
Loading

0 comments on commit 2460697

Please sign in to comment.