no more excess floods

This commit is contained in:
unek
2014-05-05 19:21:37 +02:00
parent f6dedbac65
commit 30b45db00b
2 changed files with 12 additions and 9 deletions
+11 -8
View File
@@ -152,11 +152,13 @@ client.addListener('message', function(from, channel, message) {
// comands that don't require identifying // comands that don't require identifying
if(command == 'help' || command == 'terms') if(command == 'help' || command == 'terms')
{ {
var msg = [];
for(var i = 0; i < settings.messages[command].length; i++) { for(var i = 0; i < settings.messages[command].length; i++) {
var message = settings.messages[command][i]; msg.push(settings.messages[command][i].expand({}));
client.say(channel, message.expand({}));
} }
client.say(msg.join(', '));
return; return;
} }
@@ -196,11 +198,6 @@ client.addListener('message', function(from, channel, message) {
max = Math.floor(max); max = Math.floor(max);
} }
if(amount < settings.coin.min_rain) {
client.say(channel, settings.messages.rain_too_small.expand({from: from, amount: amount}));
return;
}
coin.getBalance(from.toLowerCase(), settings.coin.min_confirmations, function(err, balance) { coin.getBalance(from.toLowerCase(), settings.coin.min_confirmations, function(err, balance) {
if(err) { if(err) {
winston.error('Error in !tip command.', err); winston.error('Error in !tip command.', err);
@@ -220,6 +217,12 @@ client.addListener('message', function(from, channel, message) {
if(max == 0) return; if(max == 0) return;
names = names.slice(0, max); names = names.slice(0, max);
if(amount / max < settings.coin.min_rain) {
client.say(channel, settings.messages.rain_too_small.expand({from: from, amount: amount}));
return;
}
for (var i = 0; i < names.length; i++) { for (var i = 0; i < names.length; i++) {
coin.move(from.toLowerCase(), names[i].toLowerCase(), amount / max, function(err, reply) { coin.move(from.toLowerCase(), names[i].toLowerCase(), amount / max, function(err, reply) {
if(err || !reply) { if(err || !reply) {
@@ -229,7 +232,7 @@ client.addListener('message', function(from, channel, message) {
}); });
} }
client.say(channel, settings.messages.rain.expand({name: from, amount: (amount / max).toFixed(3), list: names.join(', ')})); client.say(channel, settings.messages.rain.expand({name: from, amount: amount / max, list: names.join(', ')}));
}); });
} else { } else {
winston.info('%s tried to tip %s %d, but has only %d', from, to, amount, balance); winston.info('%s tried to tip %s %d, but has only %d', from, to, amount, balance);
+1 -1
View File
@@ -23,7 +23,7 @@ coin:
min_withdraw: 5 min_withdraw: 5
min_confirmations: 3 min_confirmations: 3
min_tip: 10 min_tip: 10
min_rain: 100 min_rain: 1
short_name: Đ short_name: Đ
full_name: dogecoin full_name: dogecoin
webadmin: webadmin: