Small fix to pity system
This commit is contained in:
parent
0269913a93
commit
6edfdc59f6
6
bot.js
6
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));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user