Giter Club home page Giter Club logo

legobot's Introduction

Legobot

Legobot is an ongoing project; currently, refactoring is taking place. If you wish to contribute, please do so in develop.

Table of Contents

  1. Installation
  2. Connecting to IRC

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:

  • a skeleton framework to be built upon
  • a multi-protocol API for bots (soon to include XMPP, Slack, Hipchat, etc.)
  • a basic set of functions for managing connections and message objects
  • extensible (easily)

Legobot is not:

  • complete
  • an IRC bot (it's bigger than all of us, Jim)
  • an Apple product
  • a Microsoft product
  • made of LEGOS (yet...)

Currently, Legobot is "batteries included" when being used as an IRC bot; Legobot comes with connectors (Legos) and functions that make development for IRC simple. More protocols are on the roadmap for future builds, and would be quick and simple to develop.


Installation

Installation is quite simple. Just run pip install Legobot. You can also easily install this as a non-privileged user by running pip install --user Legobot instead (this is recommended).

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:

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

from Legobot.Legos.Help import Help
from Legobot.Legos.Roll import Roll
from Legobot.Connectors.IRC import IRC

# Initialize lock and baseplate
lock = threading.Lock()
baseplate = Lego.start(None, lock)
baseplate_proxy = baseplate.proxy()

# Add children
baseplate_proxy.add_child(IRC,
                          channel='#freenode',
                          nickname='legobot',
                          server='irc.freenode.net',
                          port=6697,
                          use_ssl=True,
                          username=None,
                          password=None)
baseplate_proxy.add_child(Roll)
baseplate_proxy.add_child(Help)

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

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

Development

Information will be added as becomes relevant

When developing and running the development server or installing locally, you must install the requirment. To run the development server, just use vagrant! First, make sure you are in the Legobot directory. Then:

sudo $YourDistroPackageManager $install vagrant

Then, you just run:

vagrant up

And finally, to access the VM via SSH, you just do:

vagrant ssh

And now, you have access to the development server! cd into /legobot for a folder that syncs with your Legobot folder on your base machine. Now you have access to the code you've changed/added/created! To get Legobot ready to run, do sudo pip3 install -r requirements.txt, let pip3 do it's thing, then run python3 Legobot.py and viola! You now have a working dev server at localhost (127.0.0.1), where the bot should be in #social!

PyPI PyPI PyPI PyPI

Build Status

Master Develop
Build Status Build Status

legobot's People

Contributors

recon419a avatar kmccabe2 avatar parsec avatar bbriggs avatar hunner avatar thevilledev avatar pry0cc avatar joycezhu avatar

Watchers

Gourav Chawla(dotgourav) avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.