twitch-chatbot-boilerplate
v0.4.0
Published
Boilerplate for twitch chatbot projects
Downloads
9
Readme
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.
Install this package:
npm i twitch-chatbot-boilerplate
Generate a new secret and copy both the secret and your Client-ID
Create a
.env
file (download an example here) and enter all necessary information, alternatively you can use any other way of setting an environment variableDownload or create your own views directory. If you choose to download it, download the public directory aswell.
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));
- Write your bot's logic
- Deploy it
- Profit
Caveats
See wiki.
Available Scripts
clean
- remove caches and build files,build
- TypeScript build,build:watch
- executesbuild
on every file change,lint
- run the linter,test
- run the tests,test:watch
- executestest
on every file changegendocs
- build API docs
License
Licensed under the Unlicense. See the LICENSE file for details.