only user is shown response for cmd not running

This commit is contained in:
Emily 2022-12-12 10:22:04 +11:00
parent c3490af9d0
commit a51246ab16

View file

@ -15,15 +15,17 @@ module.exports = class {
const command = client.commands.get(interaction.commandName);
// Return if the command is disabled globally
if (command.enabled === false) interaction.reply(
client.config.emojis.permError + ' This command has been disabled by my developers.'
);
if (command.enabled === false) interaction.reply({
content: client.config.emojis.permError + ' This command has been disabled by my developers.',
ephemeral: true
});
// Return if the command is restricted to developers (and the user is not a developer)
if (command.devOnly === true && client.config.devIds.includes(interaction.user.id) !== true) {
return interaction.reply(
`${client.config.emojis.permError} ${interaction.user.username} is not in the sudoers file. This incident will be reported.`
);
return interaction.reply({
content: `${client.config.emojis.permError} ${interaction.user.username} is not in the sudoers file. This incident will be reported.`,
ephemeral: true
});
}
// Cooldown
@ -32,9 +34,10 @@ module.exports = class {
const currentTime = Date.now();
const cooldown = command.cooldown / 1000;
const timePassed = Math.floor((currentTime - timestamp) / 1000);
return interaction.reply(
`${client.config.emojis.wait} <@${interaction.user.id}>, you need to wait ${cooldown - timePassed} seconds before using this command again.`
);
return interaction.reply({
content: `${client.config.emojis.wait} You need to wait ${cooldown - timePassed} seconds before using this command again.`,
ephemeral: true
});
} else {
client.cooldowns.get(command.name).set(interaction.user.id, new Date());
setTimeout(() => {
@ -48,7 +51,10 @@ module.exports = class {
client.logger.command(`Ran ${command.name}`);
} catch (error) {
client.logger.error('COMMAND_EXECUTION_ERROR', `${command.name}: ${error.stack}`);
interaction.reply(`${client.config.emojis.botError} An error occurred when I was trying to run this command. I've sent through the details of the error to my developers.`);
interaction.reply({
content: `${client.config.emojis.botError} An error occurred when I was trying to run this command. I've sent through the details of the error to my developers.`,
ephemeral: true
});
}
}
};