flex channel

This commit is contained in:
Alex Grintsvayg 2016-07-13 16:32:51 -04:00
parent 27be6dca6f
commit 002ae49089
2 changed files with 9 additions and 5 deletions

View file

@ -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 `<your-slack-token>` below with your api token.
Then run:
```
npm install
SLACK_TOKEN=<your-slack-token> node bot.js
SLACK_TOKEN=<your-slack-token> CHANNEL=<channel-for-bot> node bot.js
```
Made by Fillerino for LBRYs slack. MIT Licensed so feel free to improve!

3
bot.js
View file

@ -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' +