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
+1 -1
View File
@@ -74,7 +74,7 @@ rpcpassword=<your super secret password>
rpcallowip=<your bot's ip address or just 127.0.0.1 if hosted on the same machine>
```
To run the bot simply use `npm start` or `node bin/tipbot`.
To run the bot simply use `node bin/tipbot` or `npm start`.
## Commands
+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;
+1
View File
@@ -62,6 +62,7 @@ messages:
invalid_address: 'Sorry %name%, the address you specified is invalid (%address%).'
tip_too_small: 'Sorry %from%, your tip to %to% (%amount%%short_name%) is too small (min. %min_tip%%short_name%).'
tip_self: "Sorry %name%, you can't tip yourself!"
invalid_amount: 'Sorry %name%, "%amount%" is not a correct amount.'
withdraw_success:
- '%name%: %amount%%short_name% has been withdrawn from your account to %address%'
- 'You have been charged %withdrawal_fee%%short_name% withdrawal fee.'