This commit is contained in:
Jan 2020-12-23 14:03:07 +01:00
parent 91693ce2ae
commit c953f74e30

View file

@ -73,18 +73,19 @@ module.exports.run = () => {
} else if (awards[reaction.emoji.id]) { } else if (awards[reaction.emoji.id]) {
let award = awards[reaction.emoji.id]; let award = awards[reaction.emoji.id];
let noTimeout = (timeouts[user.id] && timeouts[user.id] < Date.now());
let perms = message.channel.permissionsFor(user.id); let perms = message.channel.permissionsFor(user.id);
if (!perms.has('SEND_MESSAGES') || !perms.has('ADD_REACTIONS')) return reaction.users.remove(user.id); if (!perms.has('SEND_MESSAGES') || !perms.has('ADD_REACTIONS')) return reaction.users.remove(user.id);
if (coins.get(user.id) < award.cost) { if (coins.get(user.id) < award.cost) {
if (timeouts[user.id] < Date.now()) message.channel.send(`${user}, you don't have sufficient coins to use this award.`); if (noTimeout) message.channel.send(`${user}, you don't have sufficient coins to use this award.`);
reaction.users.remove(user.id); reaction.users.remove(user.id);
timeouts[user.id] = Date.now() + 5000; timeouts[user.id] = Date.now() + 5000;
return; return;
} }
if (message.author.id == user.id) { if (message.author.id == user.id) {
reaction.users.remove(user.id); reaction.users.remove(user.id);
if (timeouts[user.id] < Date.now()) message.channel.send(`${user}, why would you give an award to yourself? smh my head`); if (noTimeout) message.channel.send(`${user}, why would you give an award to yourself? smh my head`);
timeouts[user.id] = Date.now() + 5000; timeouts[user.id] = Date.now() + 5000;
return; return;
} }