allow tipping amounts lesser than 1

This commit is contained in:
unek
2014-02-23 19:24:02 +01:00
parent e3330ececc
commit 8ceb8c1098
3 changed files with 8 additions and 2 deletions
+6 -1
View File
@@ -178,7 +178,7 @@ client.addListener('message', function(from, channel, message) {
switch(command) {
case 'tip':
var match = message.match(/^.?tip (\S+) (\d+)/);
var match = message.match(/^.?tip (\S+) ([\d\.]+)/);
if(match == null || match < 3) {
client.say(channel, 'Usage: !tip <nickname> <amount>')
return;
@@ -186,6 +186,11 @@ client.addListener('message', function(from, channel, message) {
var to = match[1];
var amount = Number(match[2]);
if(amount == NaN) {
client.say(channel, settings.messages.invalid_amount.expand({name: from, amount: match[2]}));
return;
}
if(to.toLowerCase() == from.toLowerCase()) {
client.say(channel, settings.messages.self_tip.expand({name: from}));
return;