diff --git a/bot/bot.js b/bot/bot.js index 43fb30e..e72a432 100644 --- a/bot/bot.js +++ b/bot/bot.js @@ -4,106 +4,82 @@ const Discord = require('discord.js'); // Load config! let config = require('config'); -config = config.get('bot'); +let botConfig = config.get('bot'); +let commands = {}; -var aliases; -try { - aliases = require('./alias.json'); -} catch (e) { - //No aliases defined - aliases = { - test: { - process: function(bot, msg) { - msg.channel.send('test'); - } - } - }; -} -var commands = {}; +const bot = new Discord.Client(); -var bot = new Discord.Client(); - -bot.on('ready', function() { - console.log('Logged in! Serving in ' + bot.guilds.array().length + ' servers'); - require('./plugins.js').init(); - console.log('type ' + config.prefix + 'help in Discord for a commands list.'); - bot.user.setGame(config.prefix + 'tip'); +bot.on('ready', function () { + console.log('Logged in! Serving in ' + bot.guilds.array().length + ' servers'); + require('./plugins.js').init(); + console.log('type ' + botConfig.prefix + 'help in Discord for a commands list.'); + bot.user.setActivity(botConfig.prefix + 'tip'); }); -bot.on('disconnected', function() { - console.log('Disconnected!'); - process.exit(1); //exit node.js with an error +bot.on('disconnected', function () { + console.log('Disconnected!'); + process.exit(1); //exit node.js with an error }); -function checkMessageForCommand(msg, isEdit) { - //check if message is a command - if (msg.author.id != bot.user.id && msg.content.startsWith(config.prefix)) { - console.log('treating ' + msg.content + ' from ' + msg.author + ' as command'); - var cmdTxt = msg.content.split(' ')[0].substring(config.prefix.length); - var suffix = msg.content.substring(cmdTxt.length + config.prefix.length + 1); //add one for the ! and one for the space - if (msg.isMentioned(bot.user)) { - try { - cmdTxt = msg.content.split(' ')[1]; - suffix = msg.content.substring(bot.user.mention().length + cmdTxt.length + config.prefix.length + 1); - } catch (e) { - //no command - msg.channel.send('Yes?'); - return; - } - } - let alias = aliases[cmdTxt]; - if (alias) { - var cmd = alias; - } else { - var cmd = commands[cmdTxt]; - } - if (cmd) { - // Add permission check here later on ;) - try { - cmd.process(bot, msg, suffix, isEdit); - } catch (e) { - var msgTxt = 'command ' + cmdTxt + ' failed :('; - if (config.debug) { - msgTxt += '\n' + e.stack; +function checkMessageForCommand(msg) { + //check if message is a command + if (msg.author.id !== bot.user.id && msg.content.startsWith(botConfig.prefix)) { + console.log('treating ' + msg.content + ' from ' + msg.author + ' as command'); + let cmdTxt = msg.content.split(' ')[0].substring(botConfig.prefix.length); + let suffix = msg.content.substring(cmdTxt.length + botConfig.prefix.length + 1); //add one for the ! and one for the space + if (msg.isMentioned(bot.user)) { + try { + cmdTxt = msg.content.split(' ')[1]; + suffix = msg.content.substring(bot.user.mention().length + cmdTxt.length + botConfig.prefix.length + 1); + } catch (e) { + //no command + return msg.channel.send('Yes?'); + } + } + let cmd = commands[cmdTxt]; + if (cmd) { + // Add permission check here later on ;) + try { + cmd.process(bot, msg, suffix); + } catch (e) { + let msgTxt = `command ${cmdTxt} failed :(`; + if (botConfig.debug) { + msgTxt += '\n' + e.stack; + } + msg.channel.send(msgTxt); + } } - msg.channel.send(msgTxt); - } - } - } else { - //message isn't a command or is from us - //drop our own messages to prevent feedback loops - if (msg.author == bot.user) { - return; - } - - if (msg.author != bot.user && msg.isMentioned(bot.user)) { - msg.channel.send('yes?'); //using a mention here can lead to looping } else { + //message isn't a command or is from us + //drop our own messages to prevent feedback loops + if (msg.author === bot.user) { + return; + } + + if (msg.author !== bot.user && msg.isMentioned(bot.user)) { + msg.channel.send('yes?'); //using a mention here can lead to looping + } } - } } -bot.on('message', msg => checkMessageForCommand(msg, false)); -/*bot.on("messageUpdate", (oldMessage, newMessage) => { - checkMessageForCommand(newMessage, true); -});*/ +bot.on('message', msg => checkMessageForCommand(msg)); -exports.addCommand = function(commandName, commandObject) { - try { - commands[commandName] = commandObject; - } catch (err) { - console.log(err); - } +exports.addCommand = function (commandName, commandObject) { + try { + commands[commandName] = commandObject; + } catch (err) { + console.log(err); + } }; -exports.addCustomFunc = function(customFunc) { - try { - customFunc(bot); - } catch (err) { - console.log(err); - } +exports.addCustomFunc = function (customFunc) { + try { + customFunc(bot); + } catch (err) { + console.log(err); + } }; -exports.commandCount = function() { - return Object.keys(commands).length; +exports.commandCount = function () { + return Object.keys(commands).length; }; -bot.login(config.token); +bot.login(botConfig.token); diff --git a/bot/modules/tipbot.js b/bot/modules/tipbot.js index e23f67f..e0682e5 100644 --- a/bot/modules/tipbot.js +++ b/bot/modules/tipbot.js @@ -2,90 +2,96 @@ const bitcoin = require('bitcoin'); let config = require('config'); -config = config.get('lbrycrd'); -const lbry = new bitcoin.Client(config); +let lbrycrdConfig = config.get('lbrycrd'); +let sandboxChannel = config.get('sandboxchannel'); +const lbry = new bitcoin.Client(lbrycrdConfig); -exports.commands = [ - "tip" -] +exports.commands = ['tip']; exports.tip = { - usage: "", - description: 'balance: get your balance\n deposit: get address for your deposits\n withdraw ADDRESS AMOUNT: withdraw AMOUNT credits to ADDRESS\n [private] : mention a user with @ and then the amount to tip them, or put private before the user to tip them privately.\n Key: [] : Optionally include contained keyword, <> : Replace with appropriate value.', - process: async function (bot, msg, suffix) { + usage: '', + description: `balance: get your balance + deposit: get address for your deposits + withdraw ADDRESS AMOUNT: withdraw AMOUNT credits to ADDRESS + [private] : mention a user with @ and then the amount to tip them, or put private before the user to tip them privately. + Key: [] : Optionally include contained keyword, <> : Replace with appropriate value.`, + process: async function(bot, msg, suffix) { let tipper = msg.author.id.replace('!', ''), - words = msg.content.trim().split(' ').filter(function (n) { return n !== ""; }), + words = msg.content + .trim() + .split(' ') + .filter(function(n) { + return n !== ''; + }), subcommand = words.length >= 2 ? words[1] : 'help'; switch (subcommand) { - case 'help': doHelp(msg); break; - case 'balance': doBalance(msg, tipper); break; - case 'deposit': doDeposit(msg, tipper); break; - case 'withdraw': doWithdraw(msg, tipper, words); break; - default: doTip(msg, tipper, words); + case 'help': + doHelp(msg); + break; + case 'balance': + doBalance(msg, tipper); + break; + case 'deposit': + doDeposit(msg, tipper); + break; + case 'withdraw': + doWithdraw(msg, tipper, words); + break; + default: + doTip(msg, tipper, words); } } -} +}; function doBalance(message, tipper) { - lbry.getBalance(tipper, 1, function (err, balance) { + lbry.getBalance(tipper, 1, function(err, balance) { if (err) { message.reply('Error getting balance'); - } - else { + } else { message.reply('You have *' + balance + '* LBC'); } }); } - function doDeposit(message, tipper) { if (!inPrivateOrBotSandbox(message)) { - message.reply('Please use <#369896313082478594> or DMs to talk to bots.'); - return; + return message.reply(`Please use <#${sandboxChannel}> or DMs to talk to bots.`); } - getAddress(tipper, function (err, address) { + getAddress(tipper, function(err, address) { if (err) { message.reply('Error getting deposit address'); - } - else { + } else { message.reply('Your address is ' + address); } }); } - function doWithdraw(message, tipper, words) { if (!inPrivateOrBotSandbox(message)) { - message.reply('Please use <#369896313082478594> or DMs to talk to bots.'); - return; + return message.reply(`Please use <#${sandboxChannel}> or DMs to talk to bots.`); } if (words.length < 4) { - doHelp(message); - return; + return doHelp(message); } - var address = words[2], + let address = words[2], amount = getValidatedAmount(words[3]); if (amount === null) { - message.reply('I dont know how to withdraw that many credits'); + message.reply("I don't know how to withdraw that many credits"); return; } - lbry.sendFrom(tipper, address, amount, function (err, txId) { + lbry.sendFrom(tipper, address, amount, function(err, txId) { if (err) { - message.reply(err.message); - } - else { - message.reply('You withdrew ' + amount + ' to ' + address + ' (' + txLink(txId) + ')'); + return message.reply(err.message); } + message.reply(`You withdrew ${amount} to ${address} (${txLink(txId)})`); }); } - function doTip(message, tipper, words) { if (words.length < 3 || !words) { - doHelp(message); - return; + return doHelp(message); } let prv = 0; @@ -98,44 +104,40 @@ function doTip(message, tipper, words) { let amount = getValidatedAmount(words[amountOffset]); if (amount === null) { - message.reply('I dont know how to tip that many credits'); - return; + return message.reply("I don't know how to tip that many credits"); } if (message.mentions.users.first().id) { - sendLbc(message, tipper, message.mentions.users.first().id.replace('!', ''), amount, prv); - } - else { - message.reply('Sorry, I could not find a user in your tip...'); + return sendLbc(message, tipper, message.mentions.users.first().id.replace('!', ''), amount, prv); } + message.reply('Sorry, I could not find a user in your tip...'); } - function doHelp(message) { if (!inPrivateOrBotSandbox(message)) { message.reply('Sent you help via DM! Please use <#369896313082478594> or DMs to talk to bots.'); } - message.author.send('**!tip**\n balance: get your balance\n deposit: get address for your deposits\n withdraw ADDRESS AMOUNT: withdraw AMOUNT credits to ADDRESS\n [private] : mention a user with @ and then the amount to tip them, or put private before the user to tip them privately.\n Key: [] : Optionally include contained keyword, <> : Replace with appropriate value.'); + message.author.send(`**!tip** + balance: get your balance + deposit: get address for your deposits + withdraw ADDRESS AMOUNT: withdraw AMOUNT credits to ADDRESS + [private] : mention a user with @ and then the amount to tip them, or put private before the user to tip them privately. + Key: [] : Optionally include contained keyword, <> : Replace with appropriate value.`); } - function sendLbc(message, tipper, recipient, amount, privacyFlag) { - getAddress(recipient, function (err, address) { + getAddress(recipient, function(err, address) { if (err) { message.reply(err.message); - } - else { - lbry.sendFrom(tipper, address, amount, 1, null, null, function (err, txId) { + } else { + lbry.sendFrom(tipper, address, amount, 1, null, null, function(err, txId) { if (err) { message.reply(err.message); - } - else { - var imessage = - 'Wubba lubba dub dub! <@' + tipper + '> tipped <@' + recipient + '> ' + amount + ' LBC (' + txLink(txId) + '). ' + - 'DM me `!tip` for tipbot instructions.' + } else { + let imessage = `Wubba lubba dub dub! <@${tipper}> tipped <@${recipient}> ${amount} LBC (${txLink(txId)}). DM me \`!tip\` for tipbot instructions.`; if (privacyFlag) { message.author.send(imessage); - if (message.author.id != message.mentions.users.first().id) { + if (message.author.id !== message.mentions.users.first().id) { message.mentions.users.first().send(imessage); } } else { @@ -145,23 +147,19 @@ function sendLbc(message, tipper, recipient, amount, privacyFlag) { }); } }); -}; - +} function getAddress(userId, cb) { - lbry.getAddressesByAccount(userId, function (err, addresses) { + lbry.getAddressesByAccount(userId, function(err, addresses) { if (err) { cb(err); - } - else if (addresses.length > 0) { + } else if (addresses.length > 0) { cb(null, addresses[0]); - } - else { - lbry.getNewAddress(userId, function (err, address) { + } else { + lbry.getNewAddress(userId, function(err, address) { if (err) { cb(err); - } - else { + } else { cb(null, address); } }); @@ -170,11 +168,7 @@ function getAddress(userId, cb) { } function inPrivateOrBotSandbox(msg) { - if ((msg.channel.type == 'dm') || (msg.channel.id === '369896313082478594')) { - return true; - } else { - return false; - } + return msg.channel.type === 'dm' || msg.channel.id === sandboxChannel; } function getValidatedAmount(amount) { @@ -185,7 +179,6 @@ function getValidatedAmount(amount) { return amount.match(/^[0-9]+(\.[0-9]+)?$/) ? amount : null; } - function txLink(txId) { - return ""; + return ''; } diff --git a/package-lock.json b/package-lock.json index 888bce0..8faff0e 100644 --- a/package-lock.json +++ b/package-lock.json @@ -559,6 +559,7 @@ "requires": { "anymatch": "1.3.2", "async-each": "1.0.1", + "fsevents": "1.1.3", "glob-parent": "2.0.0", "inherits": "2.0.3", "is-binary-path": "1.0.1", @@ -609,9 +610,9 @@ "integrity": "sha1-2Klr13/Wjfd5OnMDajug1UBdR3s=" }, "config": { - "version": "1.28.1", - "resolved": "https://registry.npmjs.org/config/-/config-1.28.1.tgz", - "integrity": "sha1-diXSoeTJDxMdinM0eYLZPDhzKC0=", + "version": "1.29.4", + "resolved": "https://registry.npmjs.org/config/-/config-1.29.4.tgz", + "integrity": "sha1-G0J1LthrNj/EAllgVp/XSXiGKpI=", "requires": { "json5": "0.4.0", "os-homedir": "1.0.2" @@ -687,15 +688,15 @@ } }, "discord.js": { - "version": "11.2.1", - "resolved": "https://registry.npmjs.org/discord.js/-/discord.js-11.2.1.tgz", - "integrity": "sha512-8Mor+IREVWHinjRd6Bu6OwRfT+ET/WEoLWMl8crFvBVcTFmaO/TSwP39C8QIGCB2YMVMYMdljjX/w17AUMemqg==", + "version": "11.3.0", + "resolved": "https://registry.npmjs.org/discord.js/-/discord.js-11.3.0.tgz", + "integrity": "sha512-xM3ydvb4urHjCP3N+Mgpw53a7ZGtmPwllwVgwPqdF2SHNPvTDr4So/+55VVx76s5eO9IMrOWpczsEuIr0/MAgQ==", "requires": { "long": "3.2.0", "prism-media": "0.0.1", - "snekfetch": "3.6.1", + "snekfetch": "3.6.4", "tweetnacl": "1.0.0", - "ws": "3.3.2" + "ws": "4.0.0" } }, "ebnf-parser": { @@ -865,6 +866,795 @@ "resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz", "integrity": "sha1-FQStJSMVjKpA20onh8sBQRmU6k8=" }, + "fsevents": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-1.1.3.tgz", + "integrity": "sha512-WIr7iDkdmdbxu/Gh6eKEZJL6KPE74/5MEsf2whTOFNxbIoIixogroLdKYqB6FDav4Wavh/lZdzzd3b2KxIXC5Q==", + "optional": true, + "requires": { + "nan": "2.8.0", + "node-pre-gyp": "0.6.39" + }, + "dependencies": { + "abbrev": { + "version": "1.1.0", + "bundled": true, + "optional": true + }, + "ajv": { + "version": "4.11.8", + "bundled": true, + "optional": true, + "requires": { + "co": "4.6.0", + "json-stable-stringify": "1.0.1" + } + }, + "ansi-regex": { + "version": "2.1.1", + "bundled": true + }, + "aproba": { + "version": "1.1.1", + "bundled": true, + "optional": true + }, + "are-we-there-yet": { + "version": "1.1.4", + "bundled": true, + "optional": true, + "requires": { + "delegates": "1.0.0", + "readable-stream": "2.2.9" + } + }, + "asn1": { + "version": "0.2.3", + "bundled": true, + "optional": true + }, + "assert-plus": { + "version": "0.2.0", + "bundled": true, + "optional": true + }, + "asynckit": { + "version": "0.4.0", + "bundled": true, + "optional": true + }, + "aws-sign2": { + "version": "0.6.0", + "bundled": true, + "optional": true + }, + "aws4": { + "version": "1.6.0", + "bundled": true, + "optional": true + }, + "balanced-match": { + "version": "0.4.2", + "bundled": true + }, + "bcrypt-pbkdf": { + "version": "1.0.1", + "bundled": true, + "optional": true, + "requires": { + "tweetnacl": "0.14.5" + } + }, + "block-stream": { + "version": "0.0.9", + "bundled": true, + "requires": { + "inherits": "2.0.3" + } + }, + "boom": { + "version": "2.10.1", + "bundled": true, + "requires": { + "hoek": "2.16.3" + } + }, + "brace-expansion": { + "version": "1.1.7", + "bundled": true, + "requires": { + "balanced-match": "0.4.2", + "concat-map": "0.0.1" + } + }, + "buffer-shims": { + "version": "1.0.0", + "bundled": true + }, + "caseless": { + "version": "0.12.0", + "bundled": true, + "optional": true + }, + "co": { + "version": "4.6.0", + "bundled": true, + "optional": true + }, + "code-point-at": { + "version": "1.1.0", + "bundled": true + }, + "combined-stream": { + "version": "1.0.5", + "bundled": true, + "requires": { + "delayed-stream": "1.0.0" + } + }, + "concat-map": { + "version": "0.0.1", + "bundled": true + }, + "console-control-strings": { + "version": "1.1.0", + "bundled": true + }, + "core-util-is": { + "version": "1.0.2", + "bundled": true + }, + "cryptiles": { + "version": "2.0.5", + "bundled": true, + "requires": { + "boom": "2.10.1" + } + }, + "dashdash": { + "version": "1.14.1", + "bundled": true, + "optional": true, + "requires": { + "assert-plus": "1.0.0" + }, + "dependencies": { + "assert-plus": { + "version": "1.0.0", + "bundled": true, + "optional": true + } + } + }, + "debug": { + "version": "2.6.8", + "bundled": true, + "optional": true, + "requires": { + "ms": "2.0.0" + } + }, + "deep-extend": { + "version": "0.4.2", + "bundled": true, + "optional": true + }, + "delayed-stream": { + "version": "1.0.0", + "bundled": true + }, + "delegates": { + "version": "1.0.0", + "bundled": true, + "optional": true + }, + "detect-libc": { + "version": "1.0.2", + "bundled": true, + "optional": true + }, + "ecc-jsbn": { + "version": "0.1.1", + "bundled": true, + "optional": true, + "requires": { + "jsbn": "0.1.1" + } + }, + "extend": { + "version": "3.0.1", + "bundled": true, + "optional": true + }, + "extsprintf": { + "version": "1.0.2", + "bundled": true + }, + "forever-agent": { + "version": "0.6.1", + "bundled": true, + "optional": true + }, + "form-data": { + "version": "2.1.4", + "bundled": true, + "optional": true, + "requires": { + "asynckit": "0.4.0", + "combined-stream": "1.0.5", + "mime-types": "2.1.15" + } + }, + "fs.realpath": { + "version": "1.0.0", + "bundled": true + }, + "fstream": { + "version": "1.0.11", + "bundled": true, + "requires": { + "graceful-fs": "4.1.11", + "inherits": "2.0.3", + "mkdirp": "0.5.1", + "rimraf": "2.6.1" + } + }, + "fstream-ignore": { + "version": "1.0.5", + "bundled": true, + "optional": true, + "requires": { + "fstream": "1.0.11", + "inherits": "2.0.3", + "minimatch": "3.0.4" + } + }, + "gauge": { + "version": "2.7.4", + "bundled": true, + "optional": true, + "requires": { + "aproba": "1.1.1", + "console-control-strings": "1.1.0", + "has-unicode": "2.0.1", + "object-assign": "4.1.1", + "signal-exit": "3.0.2", + "string-width": "1.0.2", + "strip-ansi": "3.0.1", + "wide-align": "1.1.2" + } + }, + "getpass": { + "version": "0.1.7", + "bundled": true, + "optional": true, + "requires": { + "assert-plus": "1.0.0" + }, + "dependencies": { + "assert-plus": { + "version": "1.0.0", + "bundled": true, + "optional": true + } + } + }, + "glob": { + "version": "7.1.2", + "bundled": true, + "requires": { + "fs.realpath": "1.0.0", + "inflight": "1.0.6", + "inherits": "2.0.3", + "minimatch": "3.0.4", + "once": "1.4.0", + "path-is-absolute": "1.0.1" + } + }, + "graceful-fs": { + "version": "4.1.11", + "bundled": true + }, + "har-schema": { + "version": "1.0.5", + "bundled": true, + "optional": true + }, + "har-validator": { + "version": "4.2.1", + "bundled": true, + "optional": true, + "requires": { + "ajv": "4.11.8", + "har-schema": "1.0.5" + } + }, + "has-unicode": { + "version": "2.0.1", + "bundled": true, + "optional": true + }, + "hawk": { + "version": "3.1.3", + "bundled": true, + "requires": { + "boom": "2.10.1", + "cryptiles": "2.0.5", + "hoek": "2.16.3", + "sntp": "1.0.9" + } + }, + "hoek": { + "version": "2.16.3", + "bundled": true + }, + "http-signature": { + "version": "1.1.1", + "bundled": true, + "optional": true, + "requires": { + "assert-plus": "0.2.0", + "jsprim": "1.4.0", + "sshpk": "1.13.0" + } + }, + "inflight": { + "version": "1.0.6", + "bundled": true, + "requires": { + "once": "1.4.0", + "wrappy": "1.0.2" + } + }, + "inherits": { + "version": "2.0.3", + "bundled": true + }, + "ini": { + "version": "1.3.4", + "bundled": true, + "optional": true + }, + "is-fullwidth-code-point": { + "version": "1.0.0", + "bundled": true, + "requires": { + "number-is-nan": "1.0.1" + } + }, + "is-typedarray": { + "version": "1.0.0", + "bundled": true, + "optional": true + }, + "isarray": { + "version": "1.0.0", + "bundled": true + }, + "isstream": { + "version": "0.1.2", + "bundled": true, + "optional": true + }, + "jodid25519": { + "version": "1.0.2", + "bundled": true, + "optional": true, + "requires": { + "jsbn": "0.1.1" + } + }, + "jsbn": { + "version": "0.1.1", + "bundled": true, + "optional": true + }, + "json-schema": { + "version": "0.2.3", + "bundled": true, + "optional": true + }, + "json-stable-stringify": { + "version": "1.0.1", + "bundled": true, + "optional": true, + "requires": { + "jsonify": "0.0.0" + } + }, + "json-stringify-safe": { + "version": "5.0.1", + "bundled": true, + "optional": true + }, + "jsonify": { + "version": "0.0.0", + "bundled": true, + "optional": true + }, + "jsprim": { + "version": "1.4.0", + "bundled": true, + "optional": true, + "requires": { + "assert-plus": "1.0.0", + "extsprintf": "1.0.2", + "json-schema": "0.2.3", + "verror": "1.3.6" + }, + "dependencies": { + "assert-plus": { + "version": "1.0.0", + "bundled": true, + "optional": true + } + } + }, + "mime-db": { + "version": "1.27.0", + "bundled": true + }, + "mime-types": { + "version": "2.1.15", + "bundled": true, + "requires": { + "mime-db": "1.27.0" + } + }, + "minimatch": { + "version": "3.0.4", + "bundled": true, + "requires": { + "brace-expansion": "1.1.7" + } + }, + "minimist": { + "version": "0.0.8", + "bundled": true + }, + "mkdirp": { + "version": "0.5.1", + "bundled": true, + "requires": { + "minimist": "0.0.8" + } + }, + "ms": { + "version": "2.0.0", + "bundled": true, + "optional": true + }, + "node-pre-gyp": { + "version": "0.6.39", + "bundled": true, + "optional": true, + "requires": { + "detect-libc": "1.0.2", + "hawk": "3.1.3", + "mkdirp": "0.5.1", + "nopt": "4.0.1", + "npmlog": "4.1.0", + "rc": "1.2.1", + "request": "2.81.0", + "rimraf": "2.6.1", + "semver": "5.3.0", + "tar": "2.2.1", + "tar-pack": "3.4.0" + } + }, + "nopt": { + "version": "4.0.1", + "bundled": true, + "optional": true, + "requires": { + "abbrev": "1.1.0", + "osenv": "0.1.4" + } + }, + "npmlog": { + "version": "4.1.0", + "bundled": true, + "optional": true, + "requires": { + "are-we-there-yet": "1.1.4", + "console-control-strings": "1.1.0", + "gauge": "2.7.4", + "set-blocking": "2.0.0" + } + }, + "number-is-nan": { + "version": "1.0.1", + "bundled": true + }, + "oauth-sign": { + "version": "0.8.2", + "bundled": true, + "optional": true + }, + "object-assign": { + "version": "4.1.1", + "bundled": true, + "optional": true + }, + "once": { + "version": "1.4.0", + "bundled": true, + "requires": { + "wrappy": "1.0.2" + } + }, + "os-homedir": { + "version": "1.0.2", + "bundled": true, + "optional": true + }, + "os-tmpdir": { + "version": "1.0.2", + "bundled": true, + "optional": true + }, + "osenv": { + "version": "0.1.4", + "bundled": true, + "optional": true, + "requires": { + "os-homedir": "1.0.2", + "os-tmpdir": "1.0.2" + } + }, + "path-is-absolute": { + "version": "1.0.1", + "bundled": true + }, + "performance-now": { + "version": "0.2.0", + "bundled": true, + "optional": true + }, + "process-nextick-args": { + "version": "1.0.7", + "bundled": true + }, + "punycode": { + "version": "1.4.1", + "bundled": true, + "optional": true + }, + "qs": { + "version": "6.4.0", + "bundled": true, + "optional": true + }, + "rc": { + "version": "1.2.1", + "bundled": true, + "optional": true, + "requires": { + "deep-extend": "0.4.2", + "ini": "1.3.4", + "minimist": "1.2.0", + "strip-json-comments": "2.0.1" + }, + "dependencies": { + "minimist": { + "version": "1.2.0", + "bundled": true, + "optional": true + } + } + }, + "readable-stream": { + "version": "2.2.9", + "bundled": true, + "requires": { + "buffer-shims": "1.0.0", + "core-util-is": "1.0.2", + "inherits": "2.0.3", + "isarray": "1.0.0", + "process-nextick-args": "1.0.7", + "string_decoder": "1.0.1", + "util-deprecate": "1.0.2" + } + }, + "request": { + "version": "2.81.0", + "bundled": true, + "optional": true, + "requires": { + "aws-sign2": "0.6.0", + "aws4": "1.6.0", + "caseless": "0.12.0", + "combined-stream": "1.0.5", + "extend": "3.0.1", + "forever-agent": "0.6.1", + "form-data": "2.1.4", + "har-validator": "4.2.1", + "hawk": "3.1.3", + "http-signature": "1.1.1", + "is-typedarray": "1.0.0", + "isstream": "0.1.2", + "json-stringify-safe": "5.0.1", + "mime-types": "2.1.15", + "oauth-sign": "0.8.2", + "performance-now": "0.2.0", + "qs": "6.4.0", + "safe-buffer": "5.0.1", + "stringstream": "0.0.5", + "tough-cookie": "2.3.2", + "tunnel-agent": "0.6.0", + "uuid": "3.0.1" + } + }, + "rimraf": { + "version": "2.6.1", + "bundled": true, + "requires": { + "glob": "7.1.2" + } + }, + "safe-buffer": { + "version": "5.0.1", + "bundled": true + }, + "semver": { + "version": "5.3.0", + "bundled": true, + "optional": true + }, + "set-blocking": { + "version": "2.0.0", + "bundled": true, + "optional": true + }, + "signal-exit": { + "version": "3.0.2", + "bundled": true, + "optional": true + }, + "sntp": { + "version": "1.0.9", + "bundled": true, + "requires": { + "hoek": "2.16.3" + } + }, + "sshpk": { + "version": "1.13.0", + "bundled": true, + "optional": true, + "requires": { + "asn1": "0.2.3", + "assert-plus": "1.0.0", + "bcrypt-pbkdf": "1.0.1", + "dashdash": "1.14.1", + "ecc-jsbn": "0.1.1", + "getpass": "0.1.7", + "jodid25519": "1.0.2", + "jsbn": "0.1.1", + "tweetnacl": "0.14.5" + }, + "dependencies": { + "assert-plus": { + "version": "1.0.0", + "bundled": true, + "optional": true + } + } + }, + "string-width": { + "version": "1.0.2", + "bundled": true, + "requires": { + "code-point-at": "1.1.0", + "is-fullwidth-code-point": "1.0.0", + "strip-ansi": "3.0.1" + } + }, + "string_decoder": { + "version": "1.0.1", + "bundled": true, + "requires": { + "safe-buffer": "5.0.1" + } + }, + "stringstream": { + "version": "0.0.5", + "bundled": true, + "optional": true + }, + "strip-ansi": { + "version": "3.0.1", + "bundled": true, + "requires": { + "ansi-regex": "2.1.1" + } + }, + "strip-json-comments": { + "version": "2.0.1", + "bundled": true, + "optional": true + }, + "tar": { + "version": "2.2.1", + "bundled": true, + "requires": { + "block-stream": "0.0.9", + "fstream": "1.0.11", + "inherits": "2.0.3" + } + }, + "tar-pack": { + "version": "3.4.0", + "bundled": true, + "optional": true, + "requires": { + "debug": "2.6.8", + "fstream": "1.0.11", + "fstream-ignore": "1.0.5", + "once": "1.4.0", + "readable-stream": "2.2.9", + "rimraf": "2.6.1", + "tar": "2.2.1", + "uid-number": "0.0.6" + } + }, + "tough-cookie": { + "version": "2.3.2", + "bundled": true, + "optional": true, + "requires": { + "punycode": "1.4.1" + } + }, + "tunnel-agent": { + "version": "0.6.0", + "bundled": true, + "optional": true, + "requires": { + "safe-buffer": "5.0.1" + } + }, + "tweetnacl": { + "version": "0.14.5", + "bundled": true, + "optional": true + }, + "uid-number": { + "version": "0.0.6", + "bundled": true, + "optional": true + }, + "util-deprecate": { + "version": "1.0.2", + "bundled": true + }, + "uuid": { + "version": "3.0.1", + "bundled": true, + "optional": true + }, + "verror": { + "version": "1.3.6", + "bundled": true, + "optional": true, + "requires": { + "extsprintf": "1.0.2" + } + }, + "wide-align": { + "version": "1.1.2", + "bundled": true, + "optional": true, + "requires": { + "string-width": "1.0.2" + } + }, + "wrappy": { + "version": "1.0.2", + "bundled": true + } + } + }, "getpass": { "version": "0.1.7", "resolved": "https://registry.npmjs.org/getpass/-/getpass-0.1.7.tgz", @@ -1295,12 +2085,12 @@ "integrity": "sha512-Yh9y73JRljxW5QxN08Fner68eFLxM5ynNOAw2LbIB1YAGeQzZT8QFSUvkAz609Zf+IHhhaUxqZK8dG3W/+HEvg==" }, "mongodb": { - "version": "2.2.33", - "resolved": "https://registry.npmjs.org/mongodb/-/mongodb-2.2.33.tgz", - "integrity": "sha1-tTfEcdNKZlG0jzb9vyl1A0Dgi1A=", + "version": "2.2.34", + "resolved": "https://registry.npmjs.org/mongodb/-/mongodb-2.2.34.tgz", + "integrity": "sha1-o09Zu+thdUrsQy3nLD/iFSakTBo=", "requires": { "es6-promise": "3.2.1", - "mongodb-core": "2.1.17", + "mongodb-core": "2.1.18", "readable-stream": "2.2.7" }, "dependencies": { @@ -1321,25 +2111,25 @@ } }, "mongodb-core": { - "version": "2.1.17", - "resolved": "https://registry.npmjs.org/mongodb-core/-/mongodb-core-2.1.17.tgz", - "integrity": "sha1-pBizN6FKFJkPtRC5I97mqBMXPfg=", + "version": "2.1.18", + "resolved": "https://registry.npmjs.org/mongodb-core/-/mongodb-core-2.1.18.tgz", + "integrity": "sha1-TEYTm986HwMt7ZHbSfOO7AFlkFA=", "requires": { "bson": "1.0.4", "require_optional": "1.0.1" } }, "mongoose": { - "version": "4.13.7", - "resolved": "https://registry.npmjs.org/mongoose/-/mongoose-4.13.7.tgz", - "integrity": "sha512-3VPcGQWaTzT/OVK+TpE9dGpNHBnEqFX2RmbFr1XvbsKmxPsL9kaRBSHqaQ8QEMd6CUeOYMRdH1pKRrlnCenRsg==", + "version": "4.13.11", + "resolved": "https://registry.npmjs.org/mongoose/-/mongoose-4.13.11.tgz", + "integrity": "sha512-OgXmFc3vzXwq4zWp41XfSBDnKZLqnBc4Kh7mwwGjBE5iWH5tfkixaPK0uFtpEuzDzUvAIg33bgniyTsmc00olA==", "requires": { "async": "2.1.4", "bson": "1.0.4", "hooks-fixed": "2.0.2", "kareem": "1.5.0", "lodash.get": "4.4.2", - "mongodb": "2.2.33", + "mongodb": "2.2.34", "mpath": "0.3.0", "mpromise": "0.5.5", "mquery": "2.3.3", @@ -1387,6 +2177,12 @@ "resolved": "https://registry.npmjs.org/muri/-/muri-1.3.0.tgz", "integrity": "sha512-FiaFwKl864onHFFUV/a2szAl7X0fxVlSKNdhTf+BM8i8goEgYut8u5P9MqQqIYwvaMxjzVESsoEm/2kfkFH1rg==" }, + "nan": { + "version": "2.8.0", + "resolved": "https://registry.npmjs.org/nan/-/nan-2.8.0.tgz", + "integrity": "sha1-7XFfP+neArV6XmJS2QqWZ14fCFo=", + "optional": true + }, "node-config": { "version": "0.0.2", "resolved": "https://registry.npmjs.org/node-config/-/node-config-0.0.2.tgz", @@ -1679,7 +2475,7 @@ "integrity": "sha512-qhM/y57enGWHAe3v/NcwML6a3/vfESLe/sGM2dII+gEO0BpKRUkWZow/tyloNqJyN6kXSl3RyyM8Ll5D/sJP8g==", "requires": { "resolve-from": "2.0.0", - "semver": "5.4.1" + "semver": "5.5.0" } }, "resolve-from": { @@ -1693,9 +2489,9 @@ "integrity": "sha512-kKvNJn6Mm93gAczWVJg7wH+wGYWNrDHdWvpUmHyEsgCtIwwo3bqPtV4tR5tuPaUhTOo/kvhVwd8XwwOllGYkbg==" }, "semver": { - "version": "5.4.1", - "resolved": "https://registry.npmjs.org/semver/-/semver-5.4.1.tgz", - "integrity": "sha512-WfG/X9+oATh81XtllIo/I8gOiY9EXRdv1cQdyykeXK17YcUW3EXUAi2To4pcH6nZtJPr7ZOpM5OMyWJZm+8Rsg==" + "version": "5.5.0", + "resolved": "https://registry.npmjs.org/semver/-/semver-5.5.0.tgz", + "integrity": "sha512-4SJ3dm0WAwWy/NVeioZh5AntkdJoWKxHxcmyP622fOkgHa4z3R0TdBJICINyaSDE6uNwVc8gZr+ZinwZAH4xIA==" }, "set-immediate-shim": { "version": "1.0.1", @@ -1714,9 +2510,9 @@ "integrity": "sha1-CzpmK10Ewxd7GSa+qCsD+Dei70E=" }, "snekfetch": { - "version": "3.6.1", - "resolved": "https://registry.npmjs.org/snekfetch/-/snekfetch-3.6.1.tgz", - "integrity": "sha512-aLEvf1YR440pINb0LEo/SL2Q2s/A26+YEqPlx09A0XpGH7qWp8iqIFFolVILHn2yudWXJne9QWyQu+lzDp+ksQ==" + "version": "3.6.4", + "resolved": "https://registry.npmjs.org/snekfetch/-/snekfetch-3.6.4.tgz", + "integrity": "sha512-NjxjITIj04Ffqid5lqr7XdgwM7X61c/Dns073Ly170bPQHLm6jkmelye/eglS++1nfTWktpP6Y2bFXjdPlQqdw==" }, "sntp": { "version": "2.1.0", @@ -1898,9 +2694,9 @@ "integrity": "sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8=" }, "ws": { - "version": "3.3.2", - "resolved": "https://registry.npmjs.org/ws/-/ws-3.3.2.tgz", - "integrity": "sha512-t+WGpsNxhMR4v6EClXS8r8km5ZljKJzyGhJf7goJz9k5Ye3+b5Bvno5rjqPuIBn5mnn5GBb7o8IrIWHxX1qOLQ==", + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/ws/-/ws-4.0.0.tgz", + "integrity": "sha512-QYslsH44bH8O7/W2815u5DpnCpXWpEK44FmaHffNwgJI4JMaSZONgPBTOfrxJ29mXKbXak+LsJ2uAkDTYq2ptQ==", "requires": { "async-limiter": "1.0.0", "safe-buffer": "5.1.1", diff --git a/package.json b/package.json index 8e3d3e0..ca9ea86 100644 --- a/package.json +++ b/package.json @@ -4,22 +4,22 @@ "babel-preset-node8": "^1.2.0", "bitcoin": "^3.0.1", "chrono-node": "^1.3.5", - "config": "^1.27.0", - "discord.js": "^11.2.1", + "config": "^1.29.4", + "discord.js": "^11.3.0", "embed-creator": "^1.1.4", "jsonpath": "^0.2.12", "moment": "^2.20.1", - "mongoose": "^4.13.7", + "mongoose": "^4.13.11", "node-config": "^0.0.2", "numeral": "^2.0.6", "request": "^2.83.0" }, "scripts": { - "prettier": "prettier * --write", + "prettier": "prettier --write bot/**/*.js --single-quote --print-width 240", "build": "babel bot -d dist", "prod": "babel bot -d dist & node dist/bot.js", - "lint": "prettier --write bot/**/*.js", - "precommit": "prettier --write bot/**/*.js" + "lint": "prettier --write bot/**/*.js --single-quote --print-width 240", + "precommit": "prettier --write bot/**/*.js --single-quote --print-width 240" }, "devDependencies": { "prettier": "1.7.4"