mirror of
https://github.com/musix-org/musix-oss
synced 2024-12-23 00:23:17 +00:00
Update index.js
This commit is contained in:
parent
91e5d24e5b
commit
4ddef360fe
4
index.js
4
index.js
@ -27,7 +27,7 @@ client.on('message', message => {
|
|||||||
const args = message.content.slice(client.config.prefix.length).split(' ');
|
const args = message.content.slice(client.config.prefix.length).split(' ');
|
||||||
const commandName = args[0].toLowerCase();
|
const commandName = args[0].toLowerCase();
|
||||||
const command = client.commands.get(commandName) || client.commands.find(cmd => cmd.aliases && cmd.aliases.includes(commandName));
|
const command = client.commands.get(commandName) || client.commands.find(cmd => cmd.aliases && cmd.aliases.includes(commandName));
|
||||||
if (!command && message.content !== `${client.config.prefix}`) return message.channel.send(`:x: That is not a valid command ${message.author}! Type ${client.config.prefix}help for a list of commands!`);
|
if (!command && message.content !== `${client.config.prefix}`) return message.channel.send(`:x: That is not a valid command ${message.author}! Type ${client.config.prefix}help for a list of commands!`).then(message => message.delete(3000));
|
||||||
if (command.guildOnly && message.channel.type !== 'text') return message.reply(':x: I can\'t execute that command inside DMs!');
|
if (command.guildOnly && message.channel.type !== 'text') return message.reply(':x: I can\'t execute that command inside DMs!');
|
||||||
if (command.args && !args.length) {
|
if (command.args && !args.length) {
|
||||||
let reply = `:x: You didn't provide any arguments, ${message.author}!`;
|
let reply = `:x: You didn't provide any arguments, ${message.author}!`;
|
||||||
@ -44,7 +44,7 @@ client.on('message', message => {
|
|||||||
const expirationTime = timestamps.get(message.author.id) + cooldownAmount;
|
const expirationTime = timestamps.get(message.author.id) + cooldownAmount;
|
||||||
if (now < expirationTime) {
|
if (now < expirationTime) {
|
||||||
const timeLeft = (expirationTime - now) / 1000;
|
const timeLeft = (expirationTime - now) / 1000;
|
||||||
return message.reply(`:hourglass_flowing_sand: please wait ${timeLeft.toFixed(1)} more second(s) before reusing the \`${command.name}\` command.`);
|
return message.reply(`:hourglass_flowing_sand: please wait ${timeLeft.toFixed(1)} more second(s) before reusing the \`${command.name}\` command.`).then(message => message.delete(3000));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
timestamps.set(message.author.id, now);
|
timestamps.set(message.author.id, now);
|
||||||
|
Loading…
Reference in New Issue
Block a user