Skip to content

Latest commit

 

History

History
70 lines (59 loc) · 3.57 KB

README.md

File metadata and controls

70 lines (59 loc) · 3.57 KB

Streen Build Status Coverage Status

Deploy

Streen is a centralized interface for interacting with Twitch Chat. It is essentially a wrapper for tmi.js, and it operates via Socket.IO websockets.

Streen is useful in situations where multiple processes all need to connect to Twitch Chat, but the overhead of spinning up multiple and managing multiple chat bots is not acceptable. Streen operates as a single bot and exposes a websocket API.

Motivation

I maintain many production NodeCG instances. Most of these NodeCG instances need to connect to Twitch chat for one reason or another. At first, I had each of these NodeCG instances spin up their own tmi.js bot and connect to Twitch chat directly. However, this wound up causing problems whenever a breaking change happened, as I would have to go update tmi.js manually on each of the many deployments. Streen centralizes this external dependency into one place, making it easier to keep up with changes on Twitch's end.

Installation

Deploying to Heroku

  • Click the "Deploy to Heroku" button at the top of this README.
  • Fill out the form. Be sure to provide all required config variables.
  • If using a free dyno (the default), you'll need to prevent it from sleeping. This can be done by periodically pinging the dyno. Apex Ping and Pingdom are two options for this, but there are many ways to prevent a free web dyno from sleeping.

Manual Installation

  • Clone the repository
  • From the directory you cloned Streen into, run npm install --production
  • Create ./config.json with the desired twitch.username, twitch.password, and secretKey. The secretKey is a pre-shared key that all clients must provide in order to use the websocket API.
  • Optionally, add a slack.botToken and slack.statusChannel to have Streen post critical status updates and respond to commands. (Need an avatar for your bot?)
{
  "twitch": {
    "username": "botname",
    "password": "oauth:myOauthToken1234",
    "clientId": "abcdefghijk"
  },
  "slack": {
    "botToken": "xoxb-xxxxxxxxxx-yyyyyyyyyy",
    "statusChannel": "somechannel"
  },
  "port": 8232,
  "logLevel": "info",
  "secretKey": "xxxxx"
}
  • Run with node server.js

Example

See lfg-siphon for an example implementation.

Slack Commands

!channels

Lists the current Twitch chat channels that Streen is listening to.
channels command example

!online

Lists the online status of each Twitch stream that Streen is listening to.
online command example

!notifyoffline <channel>

Notifies you when channel stops streaming. Useful for planning maintenance or remembering to speak to someone when they go offline for the day.
notifyoffline command example

License

Streen is provided under the MIT license, which is available to read in the LICENSE file.