@twurple/easy-bot
TypeScript icon, indicating that this package has built-in type declarations

7.1.0 • Public • Published

Twurple - Bot framework

GitHub license npm version PRs welcome

A simplified framework to get a chatbot running easily.

Installation

yarn add @twurple/easy-bot

or using npm:

npm install @twurple/easy-bot

Example

import { Bot, createBotCommand } from '@twurple/easy-bot';

const bot = new Bot(null, {
	authProvider,
	channel: 'satisfiedpear',
	commands: [
		createBotCommand('d20', async (params, { user, say, timeout }) => {
			const diceRoll = Math.floor(Math.random() * 20) + 1;
			if (diceRoll === 1) {
				await say(`@${user} rolled a critical failure and must be punished!`);
				await timeout(30, 'critical failure');
			} else if (diceRoll === 20) {
				await say(`Woah, critical success! @${user} deserves all the praise!`);
			} else {
				await say(`@${user} rolled a ${diceRoll}!`);
			}
		})
	]
});

/@twurple/easy-bot/

    Package Sidebar

    Install

    npm i @twurple/easy-bot

    Weekly Downloads

    193

    Version

    7.1.0

    License

    MIT

    Unpacked Size

    306 kB

    Total Files

    90

    Last publish

    Collaborators

    • d-fischer