Skip to content

mrWh1te/Botmation

Repository files navigation

Botmation Crew

Build Status Known Vulnerabilities codecov Quality Gate Status dependencies Status GitHub

Introduction

Botmation is a simple declarative framework for building bots in TypeScript using Puppeteer. It follows a simple, composable pattern focused on a single type of function called a BotAction.

BotActions do everything, from simple tasks in crawling and scraping the web, to logging in & automating social media. They are composable, so they are easily assembled.

The possibilities are endless!

“Everything should be made as simple as possible, but no simpler.” - Albert Einstein

Why choose Botmation?

Baby Bot

It empowers Puppeteer code with a simple pattern to maximize code readability, reusability and testability.

Its compositional design comes pre-built with safe defaults for building bots with less code.

It encourages a learn at your own pace approach to exploring the possibilities of Functional programming.

Its Core library has 100% test coverage.

Getting Started

Botmation is a NodeJS library written in TypeScript. You'll need node.js LTS installed and the TypeScript compiler (tsc) installed globally (or have a transpiling code step).

Install

To get started, install Botmation's main package with npm:

Yellow Bot

npm install --save @botmation/core

If you're just getting started, install puppeteer:

npm install --save puppeteer 

You can install any other @botmation packages to extend upon the available functionality:

npm install --save @botmation/instagram

Documentation

Figure out the details with Botmation's Documentation for a deep reference into every package's functions with examples.

Core Library Reference

@botmation/core is the main package consisting of all functions in the API of Botmation docs. It has the foundational functions for building bots and a little more. Other packages, like @botmation/instagram have specific functions that work in conjunction with the core ones.

Import any core API function from:

import { chain, goTo, screenshot } from '@botmation/core'

@botmation/core v1 has 17 groups of BotActions to choose from:

Leader Bot

  • abort
    • abort an assembly of BotAction's
  • assembly-line
    • compose and run BotAction's in lines
  • branching
    • functional branching i.e. if statement
  • console
    • log messages to the nodeJS console
  • cookies
    • read/write page cookies
  • errors
    • try/catch errors in assembly-lines
  • files
    • write files to local disk ie screenshots, pdf's
  • indexed-db
    • read/write to page's IndexedDB
  • inject
    • insert new injects into a line of BotAction's
  • input
    • simulate User input ie typing and clicking with a mouse
  • local-storage
    • read/write/delete from a page's Local Storage
  • loops
    • functional loops i.e. for each
  • navigation
    • change the page's URL, wait for form submissions to change page URL, back, forward, refresh
  • pipe
    • functions specific to Piping
  • random
    • functions specific to randomness like rolling dice
  • scrapers
    • scrape HTML documents with an HTML parser and evaluate JavaScript inside a Page
  • time
    • time based operations i.e. scheduling

Contributors

Code

Michael Lage - Blog

Art

Patrick Capeto - Email