From 60647a7f3abf2dd080adec35ce34bf029faa2224 Mon Sep 17 00:00:00 2001 From: Vlad Rud Date: Mon, 16 Aug 2021 20:30:20 +0300 Subject: [PATCH] Small typo --- index.js | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/index.js b/index.js index e02a077..e0926a0 100644 --- a/index.js +++ b/index.js @@ -586,7 +586,14 @@ async function processKarma(msg, match, settings={}) { const timeDiff = (msgDate - fromDB.lastKarmaShot) / 1000 // Дальше страшная строка для поиска недавних карма-выстрелов одного юзера другому - const camraShot = CarmaShots.find((val, id) => val.from === from.id && val.to === to.id && (Date.now() - val.date) < chat.options.karmaCooldown) + const carmaShot = CarmaShots.find((val, id) => val.from === from.id && val.to === to.id && (Date.now() - val.date) < chat.options.karmaCooldown) + if (carmaShot) { + let trigger = 'tooFast' + updateValue > 0 ? "Plus" : "Minus" + const messages = await Trigger.find({trigger:trigger, show: true}) + const message = messages[getRandomInt(0, messages.length)].text + bot.sendMessage(chat_id, message, {reply_to_message_id: msg.message_id}) + return + } if(fromDB.karma < 0) { bot.sendMessage(chat_id, `Тебе с такой маленькой кармой (${fromDB.karma}) нельзя менять её другим`, {reply_to_message_id: msg.message_id}) return @@ -598,13 +605,6 @@ async function processKarma(msg, match, settings={}) { bot.sendMessage(chat_id, message, {reply_to_message_id: msg.message_id}) return } - if (carmaShot) { - let trigger = 'tooFast' + updateValue > 0 ? "Plus" : "Minus" - const messages = await Trigger.find({trigger:trigger, show: true}) - const message = messages[getRandomInt(0, messages.length)].text - bot.sendMessage(chat_id, message, {reply_to_message_id: msg.message_id}) - return - } /// TODO: Пока просто закомментим, потом если всё ок, надо удалить. // if (timeDiff < chat.options.karmaCooldown){ // const messages = await Trigger.find({trigger:'tooFast', show: true})