diff --git a/app.js b/app.js index d429ce8..53698b7 100644 --- a/app.js +++ b/app.js @@ -12,25 +12,28 @@ var slackbot = new SlackBot({ name: 'wunderbot' }); -function sendwelcomemsg(usertowelcome) { - request('https://raw.githubusercontent.com/lbryio/lbry.io/master/posts/other/slack-greeting.md', function (error, response, body) { - if (!error && response.statusCode == 200) { - bot.postMessage(usertowelcome, body); - } - })}; -var tipbot = require('./tipbot'); + +function sendWelcomeMessage(usertowelcome) { + request('https://raw.githubusercontent.com/lbryio/lbry.io/master/posts/other/slack-greeting.md', function (error, response, body) { + if (!error && response.statusCode == 200) { + slackbot.postMessage(usertowelcome, body); + } + }); +}; + +var tipbot = require('./bots/tipbot'); tipbot.init(process.env.RPCUSER, process.env.RPCPASSWORD); -var hashbot = require('./hashbot'); +var hashbot = require('./bots/hashbot'); hashbot.init(slackbot, process.env.MINING_CHANNEL); slackbot.on('start', function() { slackbot.on('message', function(data) { - if (data.type == 'team_join') { - setTimeout(function() { sendwelcomemsg(data.user.id); },2000); //Delay because of slow slack api updates which sometimes does not send msg. + if (data.type == 'team_join') { + setTimeout(function() { sendWelcomeMessage(data.user.id); }, 2000); //Delay because of slow slack api updates which sometimes does not send msg. } if (data.text) { var command = data.text.trim().split(' ')[0]; diff --git a/hashbot.js b/bots/hashbot.js similarity index 100% rename from hashbot.js rename to bots/hashbot.js diff --git a/tipbot.js b/bots/tipbot.js similarity index 100% rename from tipbot.js rename to bots/tipbot.js