mirror of
https://github.com/LBRYFoundation/lbry-wunderbot.git
synced 2025-08-23 17:47:27 +00:00
flex channel
This commit is contained in:
parent
27be6dca6f
commit
002ae49089
2 changed files with 9 additions and 5 deletions
11
README.md
11
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`.
|
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
|
- node
|
||||||
- npm > 0.12.x
|
- npm > 0.12.x
|
||||||
|
|
||||||
|
|
||||||
|
## Installation
|
||||||
|
|
||||||
Create a bot and get the bot's API Token: https://YOURSLACK.slack.com/apps/manage/custom-integrations
|
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
|
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!
|
Made by Fillerino for LBRYs slack. MIT Licensed so feel free to improve!
|
3
bot.js
3
bot.js
|
@ -2,6 +2,7 @@ var SlackBot = require('slackbots');
|
||||||
var needle = require('needle');
|
var needle = require('needle');
|
||||||
|
|
||||||
var SLACK_TOKEN = process.env.SLACK_TOKEN;
|
var SLACK_TOKEN = process.env.SLACK_TOKEN;
|
||||||
|
var CHANNEL = process.env.CHANNEL;
|
||||||
|
|
||||||
if (!SLACK_TOKEN) {
|
if (!SLACK_TOKEN) {
|
||||||
throw new Error('SLACK_TOKEN env var required');
|
throw new Error('SLACK_TOKEN env var required');
|
||||||
|
@ -27,7 +28,7 @@ function getData() {
|
||||||
difficulty = numberWithCommas(Math.round(data.difficulty)),
|
difficulty = numberWithCommas(Math.round(data.difficulty)),
|
||||||
block = numberWithCommas(data.blocks);
|
block = numberWithCommas(data.blocks);
|
||||||
|
|
||||||
bot.postMessageToChannel('testing',
|
bot.postMessageToChannel(CHANNEL,
|
||||||
// 'Blockchain stats:\n' +
|
// 'Blockchain stats:\n' +
|
||||||
'Hashrate: ' + hashrate + ' GH/s\n' +
|
'Hashrate: ' + hashrate + ' GH/s\n' +
|
||||||
'Difficulty: ' + difficulty + '\n' +
|
'Difficulty: ' + difficulty + '\n' +
|
||||||
|
|
Loading…
Add table
Reference in a new issue