From 0c95fceb210a75e346f958f0a0f036710625b57a Mon Sep 17 00:00:00 2001 From: unek Date: Sat, 22 Feb 2014 22:52:24 +0100 Subject: [PATCH] updated readme --- README.md | 5 +++++ bin/tipbot | 13 ++++++------- 2 files changed, 11 insertions(+), 7 deletions(-) diff --git a/README.md b/README.md index 4a97fcd..2af8bcb 100644 --- a/README.md +++ b/README.md @@ -48,6 +48,11 @@ Here you can restrict some commands to work only on PM/channel. ### messages Whatever the bot says. Supports expandable variables (eg. `%nick%` for bot's nick). By default all config vars from `rpc` section are available. +## How does it work? +Every nickname has it's own account in your wallet. When tipping or withdrawing, bot checks if user is registered and identified with NickServ. If so, he moves the money from one account to another, or when withdrawing, transfers coins to other wallet. + +## How to run it? +To run the bot simply use `npm start` or `node bin/tipbot`. ## Commands diff --git a/bin/tipbot b/bin/tipbot index 212c55c..02e05b4 100644 --- a/bin/tipbot +++ b/bin/tipbot @@ -106,17 +106,12 @@ client.addListener('registered', function(message) { client.say('NickServ', 'IDENTIFY ' + settings.login.nickserv_password); }); -client.addListener('close', function(message) { - client.log(message); - winston.warn('Server %s disconnected.', message); -}); - client.addListener('error', function(message) { winston.error('Received an error from IRC network: ', message); }); client.addListener('message', function(from, channel, message) { - var match = message.match(/^(!?)(\S+)/); + var match = message.match(/^(!?)(\S+)/); if(match == null) return; var prefix = match[1]; var command = match[2]; @@ -131,8 +126,12 @@ client.addListener('message', function(from, channel, message) { // if pms, make sure to respond to pms instead to itself if(channel == client.nick) channel = from; + // if not that, message will be undefined for some reason + // todo: find a fix for that + var msg = message; client.getLoginStatus(from, function(status) { - // check if the sending user is logged in (identified) + var message = msg; + // check if the sending user is logged in (identified) with nickserv if(status != 3) { winston.info('%s tried to use command `%s`, but is not identified.', from, message); client.say(channel, settings.messages.not_identified.expand({name: from}));