diff --git a/.prettierignore b/.prettierignore new file mode 100644 index 0000000..685b187 --- /dev/null +++ b/.prettierignore @@ -0,0 +1 @@ +/lib/ \ No newline at end of file diff --git a/bin/tipbot.js b/bin/tipbot.js index 964a546..6ea54dd 100644 --- a/bin/tipbot.js +++ b/bin/tipbot.js @@ -1,299 +1,289 @@ - - var winston = require('winston'), - fs = require('fs'), - yaml = require('js-yaml'), - coin = require('node-gameunits'); - - var Twitter = require('twitter'); - // check if the config file exists -if(!fs.existsSync('./config/config.yml')) { - winston.error('Configuration file doesn\'t exist! Please read the README.md file first.'); - process.exit(1); - } - // load settings - var settings = yaml.load(fs.readFileSync('./config/config.yml', 'utf-8')); - // load winston's cli defaults - winston.cli(); - // write logs to file - if (settings.log.file) { - winston.add(winston.transports.File, { - filename: settings.log.file, - level: 'debug'}); - } - // connect to coin json-rpc - winston.info('Connecting to coind...'); - var coin = coin({ - host: settings.rpc.host, - port: settings.rpc.port, - user: settings.rpc.user, - pass: settings.rpc.pass - }); - // checking if we are connected. - - coin.getBalance(function (err, balance) { - if (err) { - winston.error('Could not connect to %s RPC API! ', settings.coin.full_name, err); - process.exit(1); - return; - } - var balance = typeof (balance) == 'object' ? balance.result : balance; - winston.info('Connected to JSON RPC API. Current total balance is %d' + settings.coin.short_name, balance); - }); - - // connect to twitter - winston.info('Connecting to Twitter'); - var client = new Twitter({ - consumer_key: settings.twitter.consumer_key, - consumer_secret: settings.twitter.consumer_secret, - access_token_key: settings.twitter.access_token_key, - access_token_secret: settings.twitter.access_token_secret - }); - // - client.get('followers/ids', function(error, tweets, response){ - if(error) {console.log(error);} - winston.info('Connected to Twitter. Followers:' +tweets.ids.length); +var winston = require('winston'), + fs = require('fs'), + yaml = require('js-yaml'), + coin = require('node-gameunits'); +var Twitter = require('twitter'); +// check if the config file exists +if (!fs.existsSync('./config/config.yml')) { + winston.error("Configuration file doesn't exist! Please read the README.md file first."); + process.exit(1); +} +// load settings +var settings = yaml.load(fs.readFileSync('./config/config.yml', 'utf-8')); +// load winston's cli defaults +winston.cli(); +// write logs to file +if (settings.log.file) { + winston.add(winston.transports.File, { + filename: settings.log.file, + level: 'debug' + }); +} +// connect to coin json-rpc +winston.info('Connecting to coind...'); +var coin = coin({ + host: settings.rpc.host, + port: settings.rpc.port, + user: settings.rpc.user, + pass: settings.rpc.pass +}); +// checking if we are connected. + +coin.getBalance(function(err, balance) { + if (err) { + winston.error('Could not connect to %s RPC API! ', settings.coin.full_name, err); + process.exit(1); + return; + } + var balance = typeof balance == 'object' ? balance.result : balance; + winston.info('Connected to JSON RPC API. Current total balance is %d' + settings.coin.short_name, balance); }); +// connect to twitter +winston.info('Connecting to Twitter'); +var client = new Twitter({ + consumer_key: settings.twitter.consumer_key, + consumer_secret: settings.twitter.consumer_secret, + access_token_key: settings.twitter.access_token_key, + access_token_secret: settings.twitter.access_token_secret +}); +// +client.get('followers/ids', function(error, tweets, response) { + if (error) { + console.log(error); + } + winston.info('Connected to Twitter. Followers:' + tweets.ids.length); +}); - // basic handlers - var locks = []; - - function makeid() - { - var text = ""; - var possible = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789"; - for (var i = 0; i < 5; i++) - text += possible.charAt(Math.floor(Math.random() * possible.length)); - return text; +// basic handlers +var locks = []; + +function makeid() { + var text = ''; + var possible = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789'; + for (var i = 0; i < 5; i++) text += possible.charAt(Math.floor(Math.random() * possible.length)); + return text; +} + +function replytweet(to, replyid, themessage) { + winston.info('Preparing tweet' + '@' + to + ' :' + themessage); + var newtweet = '@' + to + ' ' + themessage + ' \nMsg_ID:(' + makeid() + ')'; + winston.info('' + '@' + to + ' :' + newtweet); + client.post('statuses/update', { status: newtweet, in_reply_to_status_id: replyid }, function(error, params, response) { + if (error) { + console.log(error); + //throw error; } - - - function replytweet(to, replyid, themessage) { - winston.info('Preparing tweet' + '@' + to + ' :' + themessage); - var newtweet = '@' + to + ' ' + themessage + ' \nMsg_ID:(' + makeid() + ')'; - winston.info('' + '@' + to + ' :' + newtweet); - client.post('statuses/update', {status: newtweet, in_reply_to_status_id: replyid}, function (error, params, response) { - if (error) { - console.log(error); - //throw error; - } - - console.log('Tweeting'); - }); - } - - function getAddress(nickname, callback) { - winston.debug('Requesting address for %s', nickname); - coin.send('getaccountaddress', settings.rpc.prefix + nickname.toLowerCase(), function (err, address) { - if (err) { - winston.error('Something went wrong while getting address. ' + err); - callback(err); - return false; - } - callback(false, address); - }); - } - String.prototype.expand = function (values) { - var global = { - nick: settings.twitter.twittername - } - return this.replace(/%([a-zA-Z_]+)%/g, function (str, variable) { - return typeof (values[variable]) == 'undefined' ? - (typeof (settings.coin[variable]) == 'undefined' ? - (typeof (global[variable]) == 'undefined' ? - str : global[variable]) : settings.coin[variable]) : values[variable]; - }); - } - client.stream('statuses/filter', {track: settings.twitter.twitterkeyword}, function (stream) { - stream.on('error', function(error) { - winston.error('Something went wrong with the twitter streaming api. '); - }); - stream.on('end', function(reason) { - winston.error('Twitter streaming api throws end'); + + console.log('Tweeting'); }); - stream.on('data', function (tweet) { - console.log('@'+ tweet.user.screen_name + '|' + tweet.text); - if ((tweet.text).substring(0,2) == "RT"){ - console.log("Retweet Ingrored"); - return; - } - var regex= new RegExp("(" + settings.twitter.twitterkeyword + ")(\\s)([a-zA-Z]+)", "i"); - var match = tweet.text.match(regex); - if (match == null) - return; - var command = match[3]; - var from = tweet.user.screen_name; - var msg = tweet.txt; - var message = tweet.text; - var replyid = tweet.id_str; - - if(command == 'help' || command == 'terms') { - for(var i = 0; i < settings.messages[command].length; i++) { - replytweet(from, replyid, settings.messages[command][i].expand({})); - } +} + +function getAddress(nickname, callback) { + winston.debug('Requesting address for %s', nickname); + coin.send('getaccountaddress', settings.rpc.prefix + nickname.toLowerCase(), function(err, address) { + if (err) { + winston.error('Something went wrong while getting address. ' + err); + callback(err); + return false; + } + callback(false, address); + }); +} +String.prototype.expand = function(values) { + var global = { + nick: settings.twitter.twittername + }; + return this.replace(/%([a-zA-Z_]+)%/g, function(str, variable) { + return typeof values[variable] == 'undefined' ? (typeof settings.coin[variable] == 'undefined' ? (typeof global[variable] == 'undefined' ? str : global[variable]) : settings.coin[variable]) : values[variable]; + }); +}; +client.stream('statuses/filter', { track: settings.twitter.twitterkeyword }, function(stream) { + stream.on('error', function(error) { + winston.error('Something went wrong with the twitter streaming api. '); + }); + stream.on('end', function(reason) { + winston.error('Twitter streaming api throws end'); + }); + stream.on('data', function(tweet) { + console.log('@' + tweet.user.screen_name + '|' + tweet.text); + if (tweet.text.substring(0, 2) == 'RT') { + console.log('Retweet Ingrored'); + return; + } + var regex = new RegExp('(' + settings.twitter.twitterkeyword + ')(\\s)([a-zA-Z]+)', 'i'); + var match = tweet.text.match(regex); + if (match == null) return; + var command = match[3]; + var from = tweet.user.screen_name; + var msg = tweet.txt; + var message = tweet.text; + var replyid = tweet.id_str; + + if (command == 'help' || command == 'terms') { + for (var i = 0; i < settings.messages[command].length; i++) { + replytweet(from, replyid, settings.messages[command][i].expand({})); + } + return; + } + + switch (command) { + case 'tip': + var regex = new RegExp('(' + settings.twitter.twitterkeyword + ')(\\s)([a-zA-Z]+)(\\s)(\\@)(.+)(\\s)(.+)', 'i'); //Uglyfix + var match = tweet.text.match(regex); + console.log('tip'); + console.log(match[0] + ',' + match[1] + ',' + match[2] + ',' + match[3] + ',' + match[4] + ',' + match[5] + ',' + match[6] + ',' + match[7] + ',' + match[8]); + if (match == null || match.length < 3) { + replytweet(from, replyid, 'Usage: nameofbot tip '); + return; + } + var to = match[6]; + var amount = Number(match[8]); + console.log('To:' + amount); + // lock + if (locks.hasOwnProperty(from.toLowerCase()) && locks[from.toLowerCase()]) return; + locks[from.toLowerCase()] = true; + + if (isNaN(amount)) { + locks[from.toLowerCase()] = null; + replytweet(from, replyid, settings.messages.invalid_amount.expand({ name: from, amount: match[8] })); + return; + } + + if (to.toLowerCase() == from.toLowerCase()) { + locks[from.toLowerCase()] = null; + replytweet(from, replyid, settings.messages.tip_self.expand({ name: from })); + return; + } + if (amount < settings.coin.min_tip) { + locks[from.toLowerCase()] = null; + replytweet(from, replyid, settings.messages.tip_too_small.expand({ from: from, to: to, amount: amount })); + return; + } + // check balance with min. 5 confirmations + coin.getBalance(settings.rpc.prefix + from.toLowerCase(), settings.coin.min_confirmations, function(err, balance) { + if (err) { + locks[from.toLowerCase()] = null; + winston.error('Error in tip command.', err); + + replytweet(from, replyid, settings.messages.error.expand({ name: from })); return; - } - - switch (command) { - case 'tip': - var regex = new RegExp("(" + settings.twitter.twitterkeyword + ")(\\s)([a-zA-Z]+)(\\s)(\\@)(.+)(\\s)(.+)", "i"); //Uglyfix - var match = tweet.text.match(regex); - console.log('tip'); - console.log(match[0] + ',' + match[1] + ',' + match[2] + ',' + match[3] + ',' + match[4] + ',' + match[5] + ',' + match[6] + ',' + match[7] + ',' + match[8]); - if (match == null || match.length < 3) { - replytweet(from, replyid, 'Usage: nameofbot tip ') - return; - } - var to = match[6]; - var amount = Number(match[8]); - console.log('To:' + amount); - // lock - if (locks.hasOwnProperty(from.toLowerCase()) && locks[from.toLowerCase()]) - return; - locks[from.toLowerCase()] = true; - - if (isNaN(amount)) { - locks[from.toLowerCase()] = null; - replytweet(from, replyid, settings.messages.invalid_amount.expand({name: from, amount: match[8]})); - return; - } - - if (to.toLowerCase() == from.toLowerCase()) { - locks[from.toLowerCase()] = null; - replytweet(from, replyid, settings.messages.tip_self.expand({name: from})); - return; - } - if (amount < settings.coin.min_tip) { - locks[from.toLowerCase()] = null; - replytweet(from, replyid, settings.messages.tip_too_small.expand({from: from, to: to, amount: amount})); - return; - } - // check balance with min. 5 confirmations - coin.getBalance(settings.rpc.prefix + from.toLowerCase(), settings.coin.min_confirmations, function (err, balance) { - if (err) { - locks[from.toLowerCase()] = null; - winston.error('Error in tip command.', err); - - replytweet(from, replyid, settings.messages.error.expand({name: from})); - return; - } - var balance = typeof (balance) == 'object' ? balance.result : balance; - if (balance >= amount) { - coin.send('move', settings.rpc.prefix + from.toLowerCase(), settings.rpc.prefix + to.toLowerCase(), amount, function (err, reply) { - locks[from.toLowerCase()] = null; - if (err || reply) { - winston.error('Error in tip command', err); - replytweet(from, replyid, settings.messages.error.expand({name: from})); - return; - } - winston.info('%s tipped %s %d%s', from, to, amount, settings.coin.short_name) - replytweet(from, replyid, settings.messages.tipped.expand({from: from, to: to, amount: amount})); - }); - } else { - locks[from.toLowerCase()] = null; - winston.info('%s tried to tip %s %d, but has only %d', from, to, amount, balance); - replytweet(from, replyid, settings.messages.no_funds.expand({name: from, balance: balance, short: amount - balance, amount: amount})); - } - }); - break; - case 'address': - console.log('adress'); - var user = from.toLowerCase(); - getAddress(user, function (err, address) { - if (err) { - winston.error('Error in address command', err); - replytweet(from, replyid, settings.messages.error.expand({name: from})); - return; - } - replytweet(from, replyid, settings.messages.deposit_address.expand({name: user, address: address})); - }); - break; - case 'balance': - console.log('balance'); - var user = from.toLowerCase(); - coin.getBalance(settings.rpc.prefix + user, settings.coin.min_confirmations, function (err, balance) { - if (err) { - winston.error('Error in balance command', err); - replytweet(from, replyid, settings.messages.error.expand({name: from})); - return; - } - var balance = typeof (balance) == 'object' ? balance.result : balance; - coin.getBalance(settings.rpc.prefix + user, 0, function (err, unconfirmed_balance) { - if (err) { - winston.error('Error in balance command', err); - replytweet(from, replyid, settings.messages.balance.expand({balance: balance, name: user})); - return; - } - var unconfirmed_balance = typeof (unconfirmed_balance) == 'object' ? unconfirmed_balance.result : unconfirmed_balance; - replytweet(from, replyid, settings.messages.balance_unconfirmed.expand({balance: balance, name: user, unconfirmed: unconfirmed_balance - balance})); - }) - }); - break; - case 'withdraw': - console.log('withdrawl'); - var user = from.toLowerCase(); - var match = message.match(/.?withdraw (\S+)$/); - if (match == null) { - replytweet(from, replyid, 'Usage: withdraw <' + settings.coin.full_name + ' address>'); - return; - } - var address = match[1]; - coin.validateAddress(address, function (err, reply) { - if (err) { - winston.error('Error in withdraw command', err); - replytweet(from, replyid, settings.messages.error.expand({name: from})); - return; - } - if (reply.isvalid) { - coin.getBalance(settings.rpc.prefix + from.toLowerCase(), settings.coin.min_confirmations, function (err, balance) { - if (err) { - winston.error('Error in withdraw command', err); - replytweet(from, replyid, settings.messages.error.expand({name: from})); - return; - } - var balance = typeof (balance) == 'object' ? balance.result : balance; - if (balance < settings.coin.min_withdraw) { - winston.warn('%s tried to withdraw %d, but min is set to %d', from, balance, settings.coin.min_withdraw); - replytweet(from, replyid, settings.messages.withdraw_too_small.expand({name: from, balance: balance})); - return; - } - coin.sendFrom(settings.rpc.prefix + from.toLowerCase(), address, balance - settings.coin.withdrawal_fee, function (err, reply) { - if (err) { - winston.error('Error in withdraw command', err); - replytweet(from, replyid, settings.messages.error.expand({name: from})); - return; - } - var values = {name: from, address: address, balance: balance, amount: balance - settings.coin.withdrawal_fee, transaction: reply} - for (var i = 0; i < settings.messages.withdraw_success.length; i++) { - var msg = settings.messages.withdraw_success[i]; - replytweet(from, replyid, msg.expand(values)); - } - ; - // transfer the rest (withdrawal fee - txfee) to bots wallet - coin.getBalance(settings.rpc.prefix + from.toLowerCase(), function (err, balance) { - if (err) { - winston.error('Something went wrong while transferring fees', err); - return; - } - var balance = typeof (balance) == 'object' ? balance.result : balance; - // moves the rest to bot's wallet - coin.move(settings.rpc.prefix + from.toLowerCase(), settings.rpc.prefix + settings.twitter.twittername.toLowerCase(), balance); - }); - }); - }); - } else { - winston.warn('%s tried to withdraw to an invalid address', from); - replytweet(from, replyid, settings.messages.invalid_address.expand({address: address, name: from})); - } - }); - break; - default: - winston.warn("Invalid Command" + command); - replytweet(from, replyid, 'Invalid command. Tweet "@LBC_TipBot lbryian help" for list of commands or see reply below') - - break; - } + } + var balance = typeof balance == 'object' ? balance.result : balance; + if (balance >= amount) { + coin.send('move', settings.rpc.prefix + from.toLowerCase(), settings.rpc.prefix + to.toLowerCase(), amount, function(err, reply) { + locks[from.toLowerCase()] = null; + if (err || reply) { + winston.error('Error in tip command', err); + replytweet(from, replyid, settings.messages.error.expand({ name: from })); + return; + } + winston.info('%s tipped %s %d%s', from, to, amount, settings.coin.short_name); + replytweet(from, replyid, settings.messages.tipped.expand({ from: from, to: to, amount: amount })); + }); + } else { + locks[from.toLowerCase()] = null; + winston.info('%s tried to tip %s %d, but has only %d', from, to, amount, balance); + replytweet(from, replyid, settings.messages.no_funds.expand({ name: from, balance: balance, short: amount - balance, amount: amount })); + } }); - }); + break; + case 'address': + console.log('adress'); + var user = from.toLowerCase(); + getAddress(user, function(err, address) { + if (err) { + winston.error('Error in address command', err); + replytweet(from, replyid, settings.messages.error.expand({ name: from })); + return; + } + replytweet(from, replyid, settings.messages.deposit_address.expand({ name: user, address: address })); + }); + break; + case 'balance': + console.log('balance'); + var user = from.toLowerCase(); + coin.getBalance(settings.rpc.prefix + user, settings.coin.min_confirmations, function(err, balance) { + if (err) { + winston.error('Error in balance command', err); + replytweet(from, replyid, settings.messages.error.expand({ name: from })); + return; + } + var balance = typeof balance == 'object' ? balance.result : balance; + coin.getBalance(settings.rpc.prefix + user, 0, function(err, unconfirmed_balance) { + if (err) { + winston.error('Error in balance command', err); + replytweet(from, replyid, settings.messages.balance.expand({ balance: balance, name: user })); + return; + } + var unconfirmed_balance = typeof unconfirmed_balance == 'object' ? unconfirmed_balance.result : unconfirmed_balance; + replytweet(from, replyid, settings.messages.balance_unconfirmed.expand({ balance: balance, name: user, unconfirmed: unconfirmed_balance - balance })); + }); + }); + break; + case 'withdraw': + console.log('withdrawl'); + var user = from.toLowerCase(); + var match = message.match(/.?withdraw (\S+)$/); + if (match == null) { + replytweet(from, replyid, 'Usage: withdraw <' + settings.coin.full_name + ' address>'); + return; + } + var address = match[1]; + coin.validateAddress(address, function(err, reply) { + if (err) { + winston.error('Error in withdraw command', err); + replytweet(from, replyid, settings.messages.error.expand({ name: from })); + return; + } + if (reply.isvalid) { + coin.getBalance(settings.rpc.prefix + from.toLowerCase(), settings.coin.min_confirmations, function(err, balance) { + if (err) { + winston.error('Error in withdraw command', err); + replytweet(from, replyid, settings.messages.error.expand({ name: from })); + return; + } + var balance = typeof balance == 'object' ? balance.result : balance; + if (balance < settings.coin.min_withdraw) { + winston.warn('%s tried to withdraw %d, but min is set to %d', from, balance, settings.coin.min_withdraw); + replytweet(from, replyid, settings.messages.withdraw_too_small.expand({ name: from, balance: balance })); + return; + } + coin.sendFrom(settings.rpc.prefix + from.toLowerCase(), address, balance - settings.coin.withdrawal_fee, function(err, reply) { + if (err) { + winston.error('Error in withdraw command', err); + replytweet(from, replyid, settings.messages.error.expand({ name: from })); + return; + } + var values = { name: from, address: address, balance: balance, amount: balance - settings.coin.withdrawal_fee, transaction: reply }; + for (var i = 0; i < settings.messages.withdraw_success.length; i++) { + var msg = settings.messages.withdraw_success[i]; + replytweet(from, replyid, msg.expand(values)); + } + // transfer the rest (withdrawal fee - txfee) to bots wallet + coin.getBalance(settings.rpc.prefix + from.toLowerCase(), function(err, balance) { + if (err) { + winston.error('Something went wrong while transferring fees', err); + return; + } + var balance = typeof balance == 'object' ? balance.result : balance; + // moves the rest to bot's wallet + coin.move(settings.rpc.prefix + from.toLowerCase(), settings.rpc.prefix + settings.twitter.twittername.toLowerCase(), balance); + }); + }); + }); + } else { + winston.warn('%s tried to withdraw to an invalid address', from); + replytweet(from, replyid, settings.messages.invalid_address.expand({ address: address, name: from })); + } + }); + break; + default: + winston.warn('Invalid Command' + command); + replytweet(from, replyid, 'Invalid command. Tweet "@LBC_TipBot lbryian help" for list of commands or see reply below'); + break; + } + }); +}); diff --git a/package-lock.json b/package-lock.json new file mode 100644 index 0000000..b4453f3 --- /dev/null +++ b/package-lock.json @@ -0,0 +1,544 @@ +{ + "name": "node-tip-bot-twitter", + "version": "1.0.2", + "lockfileVersion": 1, + "requires": true, + "dependencies": { + "amdefine": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/amdefine/-/amdefine-1.0.1.tgz", + "integrity": "sha1-SlKCrBZHKek2Gbz9OtFR+BfOkfU=" + }, + "argparse": { + "version": "0.1.16", + "resolved": "https://registry.npmjs.org/argparse/-/argparse-0.1.16.tgz", + "integrity": "sha1-z9AeD7uj1srtBJ+9dY1A9lGW9Xw=", + "requires": { + "underscore": "1.7.0", + "underscore.string": "2.4.0" + } + }, + "async": { + "version": "0.2.10", + "resolved": "https://registry.npmjs.org/async/-/async-0.2.10.tgz", + "integrity": "sha1-trvgsGdLnXGXCMo43owjfLUmw9E=" + }, + "aws-sign": { + "version": "0.2.0", + "resolved": "https://registry.npmjs.org/aws-sign/-/aws-sign-0.2.0.tgz", + "integrity": "sha1-xVAThWyBlOyFSgy+yQqrWgTOOsU=" + }, + "batch": { + "version": "0.5.0", + "resolved": "https://registry.npmjs.org/batch/-/batch-0.5.0.tgz", + "integrity": "sha1-/S4Fp6XWlrTbkxQBPihdj/NVfsM=" + }, + "boom": { + "version": "0.3.8", + "resolved": "https://registry.npmjs.org/boom/-/boom-0.3.8.tgz", + "integrity": "sha1-yM2wQUNZEnQWKMBE7Mcy0dF8Ceo=", + "requires": { + "hoek": "0.7.6" + } + }, + "buffer-crc32": { + "version": "0.2.1", + "resolved": "https://registry.npmjs.org/buffer-crc32/-/buffer-crc32-0.2.1.tgz", + "integrity": "sha1-vj5TgvwCttYySVasGvmKqYsIU0w=" + }, + "bytes": { + "version": "0.2.1", + "resolved": "https://registry.npmjs.org/bytes/-/bytes-0.2.1.tgz", + "integrity": "sha1-VVsIq8sGP4l1kFMCUj5M1P/f3zE=" + }, + "camelcase": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-1.2.1.tgz", + "integrity": "sha1-m7UwTS4LVmmLLHWLCKPqqdqlijk=" + }, + "colors": { + "version": "0.6.2", + "resolved": "https://registry.npmjs.org/colors/-/colors-0.6.2.tgz", + "integrity": "sha1-JCP+ZnisDF2uiFLl0OW+CMmXq8w=" + }, + "combined-stream": { + "version": "0.0.7", + "resolved": "https://registry.npmjs.org/combined-stream/-/combined-stream-0.0.7.tgz", + "integrity": "sha1-ATfmV7qlp1QcV6w3rF/AfXO03B8=", + "requires": { + "delayed-stream": "0.0.5" + } + }, + "commander": { + "version": "1.3.2", + "resolved": "https://registry.npmjs.org/commander/-/commander-1.3.2.tgz", + "integrity": "sha1-io8w7GcKb91kr1LxkUuQfXnq1bU=", + "requires": { + "keypress": "0.1.0" + } + }, + "connect": { + "version": "2.12.0", + "resolved": "https://registry.npmjs.org/connect/-/connect-2.12.0.tgz", + "integrity": "sha1-Mdj6DcrN8ZCNgivSkjvootKn7Zo=", + "requires": { + "batch": "0.5.0", + "buffer-crc32": "0.2.1", + "bytes": "0.2.1", + "cookie": "0.1.0", + "cookie-signature": "1.0.1", + "debug": "0.8.1", + "fresh": "0.2.0", + "methods": "0.1.0", + "multiparty": "2.2.0", + "negotiator": "0.3.0", + "pause": "0.0.1", + "qs": "0.6.6", + "raw-body": "1.1.2", + "send": "0.1.4", + "uid2": "0.0.3" + } + }, + "cookie": { + "version": "0.1.0", + "resolved": "https://registry.npmjs.org/cookie/-/cookie-0.1.0.tgz", + "integrity": "sha1-kOtGndzpBchm3mh+/EMTHYgB+dA=" + }, + "cookie-jar": { + "version": "0.2.0", + "resolved": "https://registry.npmjs.org/cookie-jar/-/cookie-jar-0.2.0.tgz", + "integrity": "sha1-ZOzAasl423leS1KQy+SLo3gUAPo=" + }, + "cookie-signature": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/cookie-signature/-/cookie-signature-1.0.1.tgz", + "integrity": "sha1-ROByFIrwHm6OJK+/EmkNaK5pjss=" + }, + "cookies": { + "version": "0.7.1", + "resolved": "https://registry.npmjs.org/cookies/-/cookies-0.7.1.tgz", + "integrity": "sha1-fIphX1SBxhq58WyDNzG8uPZjuZs=", + "requires": { + "depd": "1.1.2", + "keygrip": "1.0.2" + } + }, + "core-util-is": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.2.tgz", + "integrity": "sha1-tf1UIgqivFq1eqtxQMlAdUUDwac=" + }, + "cryptiles": { + "version": "0.1.3", + "resolved": "https://registry.npmjs.org/cryptiles/-/cryptiles-0.1.3.tgz", + "integrity": "sha1-GlVnNPBtJLo0hirpy55wmjr7/xw=", + "requires": { + "boom": "0.3.8" + } + }, + "cycle": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/cycle/-/cycle-1.0.3.tgz", + "integrity": "sha1-IegLK+hYD5i0aPN5QwZisEbDStI=" + }, + "debug": { + "version": "0.8.1", + "resolved": "https://registry.npmjs.org/debug/-/debug-0.8.1.tgz", + "integrity": "sha1-IP9NJvXkIstoobrLu2EDmtjBwTA=" + }, + "decamelize": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/decamelize/-/decamelize-1.2.0.tgz", + "integrity": "sha1-9lNNFRSCabIDUue+4m9QH5oZEpA=" + }, + "delayed-stream": { + "version": "0.0.5", + "resolved": "https://registry.npmjs.org/delayed-stream/-/delayed-stream-0.0.5.tgz", + "integrity": "sha1-1LH0OpPoKW3+AmlPRoC8N6MTxz8=" + }, + "depd": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/depd/-/depd-1.1.2.tgz", + "integrity": "sha1-m81S4UwJd2PnSbJ0xDRu0uVgtak=" + }, + "esprima": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/esprima/-/esprima-1.0.4.tgz", + "integrity": "sha1-n1V+CPw7TSbs6d00+Pv0drYlha0=" + }, + "express": { + "version": "3.4.8", + "resolved": "https://registry.npmjs.org/express/-/express-3.4.8.tgz", + "integrity": "sha1-qnqJht4HBTM39Lxe2aZFPZzI4uE=", + "requires": { + "buffer-crc32": "0.2.1", + "commander": "1.3.2", + "connect": "2.12.0", + "cookie": "0.1.0", + "cookie-signature": "1.0.1", + "debug": "0.8.1", + "fresh": "0.2.0", + "merge-descriptors": "0.0.1", + "methods": "0.1.0", + "mkdirp": "0.3.5", + "range-parser": "0.0.4", + "send": "0.1.4" + } + }, + "eyes": { + "version": "0.1.8", + "resolved": "https://registry.npmjs.org/eyes/-/eyes-0.1.8.tgz", + "integrity": "sha1-Ys8SAjTGg3hdkCNIqADvPgzCC8A=" + }, + "forever-agent": { + "version": "0.2.0", + "resolved": "https://registry.npmjs.org/forever-agent/-/forever-agent-0.2.0.tgz", + "integrity": "sha1-4cJcetROCcOPIzh2x2/MJP+EOx8=" + }, + "form-data": { + "version": "0.0.10", + "resolved": "https://registry.npmjs.org/form-data/-/form-data-0.0.10.tgz", + "integrity": "sha1-2zRaU3jYau6x7V1VO4aawZLS9e0=", + "requires": { + "async": "0.2.10", + "combined-stream": "0.0.7", + "mime": "1.2.11" + } + }, + "fresh": { + "version": "0.2.0", + "resolved": "https://registry.npmjs.org/fresh/-/fresh-0.2.0.tgz", + "integrity": "sha1-v9lALPPfEsSkwxDHn5mj3eE9NKc=" + }, + "hawk": { + "version": "0.10.2", + "resolved": "https://registry.npmjs.org/hawk/-/hawk-0.10.2.tgz", + "integrity": "sha1-mzYd7pWpMWQObVBOBWCaj8OsRdI=", + "requires": { + "boom": "0.3.8", + "cryptiles": "0.1.3", + "hoek": "0.7.6", + "sntp": "0.1.4" + } + }, + "hoek": { + "version": "0.7.6", + "resolved": "https://registry.npmjs.org/hoek/-/hoek-0.7.6.tgz", + "integrity": "sha1-YPvZBFV1Qc0rh5Wr8wihs3cOFVo=" + }, + "inherits": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.3.tgz", + "integrity": "sha1-Yzwsg+PaQqUC9SRmAiSA9CCCYd4=" + }, + "isarray": { + "version": "0.0.1", + "resolved": "https://registry.npmjs.org/isarray/-/isarray-0.0.1.tgz", + "integrity": "sha1-ihis/Kmo9Bd+Cav8YDiTmwXR7t8=" + }, + "js-yaml": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-3.0.2.tgz", + "integrity": "sha1-mTeGX46Jel6JTnPCxc8uibMut3E=", + "requires": { + "argparse": "0.1.16", + "esprima": "1.0.4" + } + }, + "json-stringify-safe": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/json-stringify-safe/-/json-stringify-safe-3.0.0.tgz", + "integrity": "sha1-nbew5TDH8onF6MhDKvGRwv91pbM=" + }, + "keygrip": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/keygrip/-/keygrip-1.0.2.tgz", + "integrity": "sha1-rTKXxVcGneqLz+ek+kkbdcXd65E=" + }, + "keypress": { + "version": "0.1.0", + "resolved": "https://registry.npmjs.org/keypress/-/keypress-0.1.0.tgz", + "integrity": "sha1-SjGI1CkbZrT2XtuZ+AaqmuKTWSo=" + }, + "merge-descriptors": { + "version": "0.0.1", + "resolved": "https://registry.npmjs.org/merge-descriptors/-/merge-descriptors-0.0.1.tgz", + "integrity": "sha1-L/CYDJJM+B0LXR+2ARd8uLtWwNA=" + }, + "methods": { + "version": "0.1.0", + "resolved": "https://registry.npmjs.org/methods/-/methods-0.1.0.tgz", + "integrity": "sha1-M11Cnu/SG3us8unJIqjSvRSjDk8=" + }, + "mime": { + "version": "1.2.11", + "resolved": "https://registry.npmjs.org/mime/-/mime-1.2.11.tgz", + "integrity": "sha1-WCA+7Ybjpe8XrtK32evUfwpg3RA=" + }, + "minimist": { + "version": "0.0.10", + "resolved": "https://registry.npmjs.org/minimist/-/minimist-0.0.10.tgz", + "integrity": "sha1-3j+YVD2/lggr5IrRoMfNqDYwHc8=" + }, + "mkdirp": { + "version": "0.3.5", + "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.3.5.tgz", + "integrity": "sha1-3j5fiWHIjHh+4TaN+EmsRBPsqNc=" + }, + "multiparty": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/multiparty/-/multiparty-2.2.0.tgz", + "integrity": "sha1-pWfCrwAK0i3I8qZT2Rl4rh9TFvQ=", + "requires": { + "readable-stream": "1.1.14", + "stream-counter": "0.2.0" + } + }, + "negotiator": { + "version": "0.3.0", + "resolved": "https://registry.npmjs.org/negotiator/-/negotiator-0.3.0.tgz", + "integrity": "sha1-cG1pLv7d9XTVfqn7GriaT6fuj2A=" + }, + "node-gameunits": { + "version": "0.3.9", + "resolved": "https://registry.npmjs.org/node-gameunits/-/node-gameunits-0.3.9.tgz", + "integrity": "sha1-UFwJK/+WTRvco43oV+aZdrZDhv0=" + }, + "node-uuid": { + "version": "1.4.8", + "resolved": "https://registry.npmjs.org/node-uuid/-/node-uuid-1.4.8.tgz", + "integrity": "sha1-sEDrCSOWivq/jTL7HxfxFn/auQc=" + }, + "oauth": { + "version": "0.9.15", + "resolved": "https://registry.npmjs.org/oauth/-/oauth-0.9.15.tgz", + "integrity": "sha1-vR/vr2hslrdUda7VGWQS/2DPucE=" + }, + "oauth-sign": { + "version": "0.2.0", + "resolved": "https://registry.npmjs.org/oauth-sign/-/oauth-sign-0.2.0.tgz", + "integrity": "sha1-oOahcV2u0GLzIrYit/5a/RA1tuI=" + }, + "optimist": { + "version": "0.6.1", + "resolved": "https://registry.npmjs.org/optimist/-/optimist-0.6.1.tgz", + "integrity": "sha1-2j6nRob6IaGaERwybpDrFaAZZoY=", + "requires": { + "minimist": "0.0.10", + "wordwrap": "0.0.3" + } + }, + "pause": { + "version": "0.0.1", + "resolved": "https://registry.npmjs.org/pause/-/pause-0.0.1.tgz", + "integrity": "sha1-HUCLP9t2kjuVQ9lvtMnf1TXZy10=" + }, + "pkginfo": { + "version": "0.3.1", + "resolved": "https://registry.npmjs.org/pkginfo/-/pkginfo-0.3.1.tgz", + "integrity": "sha1-Wyn2qB9wcXFC4J52W76rl7T4HiE=" + }, + "prettier": { + "version": "1.8.1", + "resolved": "https://registry.npmjs.org/prettier/-/prettier-1.8.1.tgz", + "integrity": "sha512-YD5mApxnu/o/u7kiy5C4ouMfzJMXGEQdHyGHtQd0KwN/CrwTwD8RuTNzpInZEYZn9S8m10zDvVT5gAO4pp+0FA==", + "dev": true + }, + "qs": { + "version": "0.6.6", + "resolved": "https://registry.npmjs.org/qs/-/qs-0.6.6.tgz", + "integrity": "sha1-bgFQmP9RlouKPIGQAdXyyJvEsQc=" + }, + "range-parser": { + "version": "0.0.4", + "resolved": "https://registry.npmjs.org/range-parser/-/range-parser-0.0.4.tgz", + "integrity": "sha1-wEJ//vUcEKy6B4KkbJYC50T/Ygs=" + }, + "raw-body": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/raw-body/-/raw-body-1.1.2.tgz", + "integrity": "sha1-x0swBN6l3v0WlhcRBqx0DsMdYr4=", + "requires": { + "bytes": "0.2.1" + } + }, + "readable-stream": { + "version": "1.1.14", + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-1.1.14.tgz", + "integrity": "sha1-fPTFTvZI44EwhMY23SB54WbAgdk=", + "requires": { + "core-util-is": "1.0.2", + "inherits": "2.0.3", + "isarray": "0.0.1", + "string_decoder": "0.10.31" + } + }, + "request": { + "version": "2.16.6", + "resolved": "https://registry.npmjs.org/request/-/request-2.16.6.tgz", + "integrity": "sha1-hy/kRa5y3iZrN4edatfclI+gHK0=", + "requires": { + "aws-sign": "0.2.0", + "cookie-jar": "0.2.0", + "forever-agent": "0.2.0", + "form-data": "0.0.10", + "hawk": "0.10.2", + "json-stringify-safe": "3.0.0", + "mime": "1.2.11", + "node-uuid": "1.4.8", + "oauth-sign": "0.2.0", + "qs": "0.5.6", + "tunnel-agent": "0.2.0" + }, + "dependencies": { + "qs": { + "version": "0.5.6", + "resolved": "https://registry.npmjs.org/qs/-/qs-0.5.6.tgz", + "integrity": "sha1-MbGtBYVnZRxSaSFQa5qHk5EaA4Q=" + } + } + }, + "send": { + "version": "0.1.4", + "resolved": "https://registry.npmjs.org/send/-/send-0.1.4.tgz", + "integrity": "sha1-vnDY0b4B3mGCGvE3gLUDRaT3Gr0=", + "requires": { + "debug": "0.8.1", + "fresh": "0.2.0", + "mime": "1.2.11", + "range-parser": "0.0.4" + } + }, + "sntp": { + "version": "0.1.4", + "resolved": "https://registry.npmjs.org/sntp/-/sntp-0.1.4.tgz", + "integrity": "sha1-XvSBuVGnspr/30r9fyaDj8ESD4Q=", + "requires": { + "hoek": "0.7.6" + } + }, + "source-map": { + "version": "0.1.34", + "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.1.34.tgz", + "integrity": "sha1-p8/omux7FoLDsZjQrPtH19CQVms=", + "requires": { + "amdefine": "1.0.1" + } + }, + "stack-trace": { + "version": "0.0.10", + "resolved": "https://registry.npmjs.org/stack-trace/-/stack-trace-0.0.10.tgz", + "integrity": "sha1-VHxws0fo0ytOEI6hoqFZ5f3eGcA=" + }, + "stream-counter": { + "version": "0.2.0", + "resolved": "https://registry.npmjs.org/stream-counter/-/stream-counter-0.2.0.tgz", + "integrity": "sha1-3tJmVWMZyLDiIoErnPOyb6fZR94=", + "requires": { + "readable-stream": "1.1.14" + } + }, + "string_decoder": { + "version": "0.10.31", + "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-0.10.31.tgz", + "integrity": "sha1-YuIDvEF2bGwoyfyEMB2rHFMQ+pQ=" + }, + "swig": { + "version": "1.3.2", + "resolved": "https://registry.npmjs.org/swig/-/swig-1.3.2.tgz", + "integrity": "sha1-GsroKh/7TQLG6E0KlHnmb2Gvaoc=", + "requires": { + "optimist": "0.6.1", + "uglify-js": "2.4.24" + } + }, + "tunnel-agent": { + "version": "0.2.0", + "resolved": "https://registry.npmjs.org/tunnel-agent/-/tunnel-agent-0.2.0.tgz", + "integrity": "sha1-aFPCr7GyEJ5FYp5JK9419Fnqaeg=" + }, + "twitter": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/twitter/-/twitter-1.0.3.tgz", + "integrity": "sha1-zgks1fGPGYaK1fvNC7tPqACgQnw=", + "requires": { + "cookies": "0.7.1", + "keygrip": "1.0.2", + "oauth": "0.9.15" + } + }, + "uglify-js": { + "version": "2.4.24", + "resolved": "https://registry.npmjs.org/uglify-js/-/uglify-js-2.4.24.tgz", + "integrity": "sha1-+tV1XB4Vd2WLsG/5q25UjJW+vW4=", + "requires": { + "async": "0.2.10", + "source-map": "0.1.34", + "uglify-to-browserify": "1.0.2", + "yargs": "3.5.4" + } + }, + "uglify-to-browserify": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/uglify-to-browserify/-/uglify-to-browserify-1.0.2.tgz", + "integrity": "sha1-bgkk1r2mta/jSeOabWMoUKD4grc=" + }, + "uid2": { + "version": "0.0.3", + "resolved": "https://registry.npmjs.org/uid2/-/uid2-0.0.3.tgz", + "integrity": "sha1-SDEm4Rd03y9xuLY53NeZw3YWK4I=" + }, + "underscore": { + "version": "1.7.0", + "resolved": "https://registry.npmjs.org/underscore/-/underscore-1.7.0.tgz", + "integrity": "sha1-a7rwh3UA02vjTsqlhODbn+8DUgk=" + }, + "underscore.string": { + "version": "2.4.0", + "resolved": "https://registry.npmjs.org/underscore.string/-/underscore.string-2.4.0.tgz", + "integrity": "sha1-jN2PusTi0uoefi6Al8QvRCKA+Fs=" + }, + "window-size": { + "version": "0.1.0", + "resolved": "https://registry.npmjs.org/window-size/-/window-size-0.1.0.tgz", + "integrity": "sha1-VDjNLqk7IC76Ohn+iIeu58lPnJ0=" + }, + "winston": { + "version": "0.7.3", + "resolved": "https://registry.npmjs.org/winston/-/winston-0.7.3.tgz", + "integrity": "sha1-euMTunP83C7LSqL5zURugphncmY=", + "requires": { + "async": "0.2.10", + "colors": "0.6.2", + "cycle": "1.0.3", + "eyes": "0.1.8", + "pkginfo": "0.3.1", + "request": "2.16.6", + "stack-trace": "0.0.10" + } + }, + "wordwrap": { + "version": "0.0.3", + "resolved": "https://registry.npmjs.org/wordwrap/-/wordwrap-0.0.3.tgz", + "integrity": "sha1-o9XabNXAvAAI03I0u68b7WMFkQc=" + }, + "yargs": { + "version": "3.5.4", + "resolved": "https://registry.npmjs.org/yargs/-/yargs-3.5.4.tgz", + "integrity": "sha1-2K/49mXpTDS9JZvevRv68N3TU2E=", + "requires": { + "camelcase": "1.2.1", + "decamelize": "1.2.0", + "window-size": "0.1.0", + "wordwrap": "0.0.2" + }, + "dependencies": { + "wordwrap": { + "version": "0.0.2", + "resolved": "https://registry.npmjs.org/wordwrap/-/wordwrap-0.0.2.tgz", + "integrity": "sha1-t5Zpu0LstAn4PVg8rVLKF+qhZD8=" + } + } + } + } +} diff --git a/package.json b/package.json index 0cadc51..eb7de9e 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "node-tip-bot-twitter", - "version": "1.0.1", + "version": "1.0.2", "description": "node.js based tipping bot for any coin", "main": "bin/tipbot", "dependencies": { @@ -11,10 +11,17 @@ "swig": "1.3.2", "express": "3.4.8" }, - "devDependencies": {}, + "devDependencies": { + "prettier": "1.8.1" + }, "scripts": { "test": "echo \"Error: no test specified\" && exit 1", - "start": "node bin/tipbot" + "start": "node bin/tipbot", + "prettier": "prettier --write \"{bot,.}/**/*.{js,json}\" --single-quote --print-width 240", + "build": "babel bot -d dist", + "prod": "babel bot -d dist & node dist/bot.js", + "lint": "prettier --write \"{bot,.}/**/*.{js,json}\" --single-quote --print-width 240", + "precommit": "prettier --write \"{bot,.}/**/*.{js,json}\" --single-quote --print-width 240" }, "repository": { "type": "git", @@ -26,14 +33,5 @@ "url": "https://github.com/gameunits/node-tip-bot/issues" }, "homepage": "https://github.com/gameunits/node-tip-bot", - "keywords": [ - "gameunits", - "bitcoin", - "litecoin", - "altcoin", - "tip", - "tipbot", - "irc", - "bot" - ] + "keywords": ["gameunits", "bitcoin", "litecoin", "altcoin", "tip", "tipbot", "irc", "bot"] }