JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 71
  • Score
    100M100P100Q58120F
  • License MIT

Stream announcement bot for Discord

Package Exports

  • streambot.js
  • streambot.js/dist/index.js

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (streambot.js) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

streambot.js

node-current GitHub npm

Library that exports a ready-to-use Discord bot that relays online stream status messages for your streamers of choice from supported platforms.

Currently supports:

  • Twitch.tv
  • Trovo.live
  • YouTube.com

Source Requirements:

  • Twitch.tv
    • A valid SSL certificate (privkey & fullchain) to sign subscriptions
    • External port 443 open (if hosting an HTTPS app with expressjs use the middleware)
  • YouTube.com
    • An API key with YouTube Data API v3 enabled

Installation

npm install streambot.js

Standalone Usage

const bot = new StreambotJs(opts, sslCert);
bot.init(opts).subscribe();

Express Middleware

const app = express();
const bot = new StreambotJs(opts, sslCert);
await bot.expressMiddleware.apply(app);
app.listen(443, () => {
  bot.init(opts).subscribe();
});

Loading and saving configuration

To allow more flexibility for the end user's storage choices, the library doesn't store its configuration to any file.

To load existing configuration from storage: You should load your configuration before initializing the bot

const configuration: StreambotJsConfiguration = getFromStorage();
bot.setConfiguration(configuration);
bot.init(opts).subscribe();

To subscribe to configuration changes

bot.configurationChanges.subscribe((configuration: StreambotJsConfiguration) => {
  saveToStorage(configuration);
});