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