streambot.js
TypeScript icon, indicating that this package has built-in type declarations

1.4.4 • Public • Published

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);
});

/streambot.js/

    Package Sidebar

    Install

    npm i streambot.js

    Weekly Downloads

    2

    Version

    1.4.4

    License

    MIT

    Unpacked Size

    88.3 kB

    Total Files

    57

    Last publish

    Collaborators

    • redeven