From 6edfdc59f6260d38aaba0f8c217a0f7736882979 Mon Sep 17 00:00:00 2001 From: root Date: Fri, 3 Sep 2021 20:44:13 +0200 Subject: [PATCH] Small fix to pity system --- bot.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/bot.js b/bot.js index cef5674..49cc091 100644 --- a/bot.js +++ b/bot.js @@ -95,7 +95,7 @@ function onMessageHandler (channel, userstate, message, self) { switch (action) { case "config": - client.say(channel, "Chance: " + config.chance + "% - Limit: " + config.limit + " - Word: " + config.word + " - Ignored Users: " + config.ignoredUsers.join(', ')); + client.say(channel, "Chance: " + config.chance + "% - Pity: " + config.pity + " - Limit: " + config.limit + " - Word: " + config.word + " - Min. Syllables: " + config.syllableCount + " - Ignored Users: " + config.ignoredUsers.join(', ')); break; case "word": config.word = value; @@ -244,7 +244,7 @@ function onMessageHandler (channel, userstate, message, self) { // random chance // TODO: find a better alternative var number = Math.random() * 100; - if (number <= config.chance || (config.pity != 0 && pityTracker[channel] && pityTracker[channel] == config.pity)) { + if (number <= config.chance || (config.pity != 0 && pityTracker[channel] && pityTracker[channel] >= config.pity)) { pityTracker[channel] = 0; @@ -288,6 +288,8 @@ function onMessageHandler (channel, userstate, message, self) { messageCounter[channel] = counter; fs.writeFileSync('counter', JSON.stringify(messageCounter)); + + console.log(JSON.stringify(pityTracker)); } } }