From be9867821e7b0833c394e361aedaa9e87efaae8e Mon Sep 17 00:00:00 2001 From: Vlad Rud Date: Mon, 16 Aug 2021 20:49:30 +0300 Subject: [PATCH] Debugging prints --- index.js | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/index.js b/index.js index 6dbd304..f900b87 100644 --- a/index.js +++ b/index.js @@ -586,7 +586,11 @@ async function processKarma(msg, match, settings={}) { const timeDiff = (msgDate - fromDB.lastKarmaShot) / 1000 // Дальше страшная строка для поиска недавних карма-выстрелов одного юзера другому - const carmaShot = CarmaShots.find((val, id) => val.from === from.id && val.to === to.id && (Date.now() - val.date) < chat.options.karmaCooldown) + console.log("OLD CARMA SHOTS: ") + console.log({CarmaShots}) + const carmaShot = CarmaShots.find((val, id) => val.from === from.id && val.to === to.id && (Date.now() - val.date) < chat.options.karmaCooldown) + console.log("FOUND SHOT: ") + console.log({carmaShot}) if (carmaShot) { let trigger = 'tooFast' + updateValue > 0 ? "Plus" : "Minus" const messages = await Trigger.find({trigger:trigger, show: true}) @@ -653,6 +657,8 @@ async function processKarma(msg, match, settings={}) { const message = `*${markdowned(fromDB.full_name)} \\(${markdowned(fromDB.karma)}\\)* ${changeMessage} карму *${markdowned(toDB.full_name)} \\(${markdowned(toDB.karma + updateValue)}\\)*` console.log(message) CarmaShots.push({from: from.id, to: to.id, date: Date.now()}) + console.log("NEW CarmaShots: ") + console.log({CarmaShots}) bot.sendMessage(chat_id, message, {parse_mode: "MarkdownV2"}) } }