Legobot/Legobot

Name: Legobot

Owner: Legobot

Description: Yet another chatops framework

Created: 2014-07-07 20:59:17.0

Updated: 2017-11-09 12:14:58.0

Pushed: 2018-01-03 20:00:55.0

Homepage:

Size: 415

Language: Python

GitHub Committers

UserMost Recent Commit# Commits

Other Committers

UserEmailMost Recent Commit# Commits

README

Legobot

Travis CI PyPI PyPI PyPI PyPI PyPI

Table of Contents
  1. Introduction
  2. Supported Backends
  3. Installation
  4. Alternative (easier) install and run method
  5. Contributing
Introduction

Legobot is a platform that aims to make interactive multi-protocol bots less of a chore and more of a simple pleasure.

Legobot itself is:

Supported backends

in planned order for support

Installation

Installation is quite simple. Since we are on python3, just run pip3 install Legobot. You can also easily install this as a non-privileged user by running pip3 install --user Legobot instead.

Alternative installation

For things like Legobot, Docker might just be the greatest thing since sliced bread. If you want to run Legobot without installing the library on your host, you can always use a Virtualenv (gross) or use docker (fun!)

Here is the docker run command I've been using lately for my own instances: docker run -d -it --name Legobot -v "$PWD":/usr/src/legobot -w /usr/src/legobot python:3 sh -c 'pip install -r requirements.txt && python chatbot.py'.

This of course assumes a couple things:

But I think you get the picture. It's easy to run in a Docker container and you can run multiple instances with possible conflicting libraries without having to set up a virtual env or pollute your host machine.

Connecting to IRC

Legobot is intended to be simple, flexible, and painless; thereby allowing the user to control all functionality. Consequently, Legobot doesn't really do much on its own, other than monitor messages and manage connections. All triggers, responses, and functions are yours to create: this could range from an automated function to report Nginx monitoring info at a set interval, to a function for checking the weather, to a function that simply states “Hello, World!“. The possibilities are endless, only bound by your imagination (and will to create).

An example of a basic bot that is functional (connects to server, etc.) might look like this:

rt logging
rt threading
 Legobot.Lego import Lego
 Legobot.Connectors import *

 Legobot.Legos.Help import Help
 Legobot.Connectors.IRC import IRC

other lego available on PyPi
 legos.dice import Roll

itialize lock and baseplate
 = threading.Lock()
er = Lego.start(None, lock)
er_proxy = master.proxy()

d children
er_proxy.add_child(IRC,
                      channels=['#freenode'],
                      nickname='legobot',
                      server='chat.freenode.net')
er_proxy.add_child(Roll)
er_proxy.add_child(Help)

For the above example, we implemented the !roll Lego. Now, to see this in action!

sec> !help
obot> Available functions: roll
sec> !help roll
obot> Roll some dice. Usage: !roll 2d6t, !roll 6d6^3, !roll d20
sec> !roll 2d10
obot> You Rolled: 7, 3
sec> !roll d20
obot> You Rolled: 2

For a deeper dive into how Legobot works, see our documentation

Contributing

We hang out and do our dev chat on the 0x00sec IRC in #legobot. Drop by and say hey!

TO DO: Expand contributing docs


This work is supported by the National Institutes of Health's National Center for Advancing Translational Sciences, Grant Number U24TR002306. This work is solely the responsibility of the creators and does not necessarily represent the official views of the National Institutes of Health.