mirror of
https://github.com/jwinterm/node-tip-bot.git
synced 2026-10-17 05:41:42 +02:00
allow tipping amounts lesser than 1
This commit is contained in:
@@ -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
@@ -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;
|
||||
|
||||
@@ -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.'
|
||||
|
||||
Reference in New Issue
Block a user