twitch-chatbot-boilerplate
TypeScript icon, indicating that this package has built-in type declarations

0.4.0 • Public • Published

Unlicense Dependabot Maintainability Test Coverage

twitch-chatbot-boilerplate-core

API DOCS | Wiki

This project is not affiliated to Twitch Interactive Inc in any way.

Read this first

This package should only be used directly when you don't seek for a full boilerplate as it only exports the initialize() function. It is recommended for new projects to use the main repo as a boilerplate.

How does it work?

Read the main repo's setup guide first, register an app and create a new account.

  1. Install this package: npm i twitch-chatbot-boilerplate

  2. Generate a new secret and copy both the secret and your Client-ID

  3. Create a .env file (download an example here) and enter all necessary information, alternatively you can use any other way of setting an environment variable

  4. Download or create your own views directory. If you choose to download it, download the public directory aswell.

  5. Call initialize() and follow further instructions

const { initialize } = require('twitch-chatbot-boilerplate');
 
async function main() {
    const { client } = await initialize();
 
    // This is the example on the tmi.js website
    client.on('message', (channel, userstate, message, self) => {
        if (self) return;
        if (message.toLowerCase() === '!hello') {
            client.say(channel, `@${userstate.username}, heya!`);
        }
    });
}
main().catch((e) => console.error(e));
  1. Write your bot's logic
  2. Deploy it
  3. Profit

Next Steps

Caveats

See wiki.

Available Scripts

  • clean - remove caches and build files,
  • build - TypeScript build,
  • build:watch - executes build on every file change,
  • lint - run the linter,
  • test - run the tests,
  • test:watch - executes test on every file change
  • gendocs - build API docs

License

Licensed under the Unlicense. See the LICENSE file for details.

Readme

Keywords

none

Package Sidebar

Install

npm i twitch-chatbot-boilerplate

Weekly Downloads

0

Version

0.4.0

License

Unlicense

Unpacked Size

56.5 kB

Total Files

43

Last publish

Collaborators

  • fosefx