From 002ae49089fc1054da71dfc4e2b4b1a020ad3095 Mon Sep 17 00:00:00 2001 From: Alex Grintsvayg Date: Wed, 13 Jul 2016 16:32:51 -0400 Subject: [PATCH] flex channel --- README.md | 11 +++++++---- bot.js | 3 ++- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index d09bf63..16ec452 100644 --- a/README.md +++ b/README.md @@ -2,20 +2,23 @@ Hashbot for [LBRY's Slack](https://slack.lbry.io). Posts mining info to #mining every hour and anytime someone says `!hash`. -## Installation -Requirements: +## Requirements - node - npm > 0.12.x + +## Installation + Create a bot and get the bot's API Token: https://YOURSLACK.slack.com/apps/manage/custom-integrations -Replace `` below with your api token. +Then run: ``` npm install -SLACK_TOKEN= node bot.js +SLACK_TOKEN= CHANNEL= node bot.js ``` + Made by Fillerino for LBRYs slack. MIT Licensed so feel free to improve! \ No newline at end of file diff --git a/bot.js b/bot.js index 1b4e41d..4ef85b7 100644 --- a/bot.js +++ b/bot.js @@ -2,6 +2,7 @@ var SlackBot = require('slackbots'); var needle = require('needle'); var SLACK_TOKEN = process.env.SLACK_TOKEN; +var CHANNEL = process.env.CHANNEL; if (!SLACK_TOKEN) { throw new Error('SLACK_TOKEN env var required'); @@ -27,7 +28,7 @@ function getData() { difficulty = numberWithCommas(Math.round(data.difficulty)), block = numberWithCommas(data.blocks); - bot.postMessageToChannel('testing', + bot.postMessageToChannel(CHANNEL, // 'Blockchain stats:\n' + 'Hashrate: ' + hashrate + ' GH/s\n' + 'Difficulty: ' + difficulty + '\n' +