Code Monkey home page Code Monkey logo

eizzek's Introduction

Eizzek Bot

Eizzek is a simple g-talk bot built on top of Twisted and Wokkel.

To start just execute the command:

make start

To run all tests use:

make test

Dependencies

  • Twisted
  • Wokkel
  • PyOpenSSL
  • Nose
  • lxml

config.py

You need to create a config.py file with some variables:

JID = '[email protected]/fun'
PASSWORD = 'secret'
SERVER = 'talk.google.com'
PORT = 5222

Plugins

A plugin is a way to make the bot do something. There are (will be) two types of plugins: simple and session plugins.

Simple Plugins

A simple plugin is just a regex and a function that returns a string. There is an example in plugins/ping.py.

When a message arrives, if any simple plugin regex matches the function will be called. This is already working :)

SessionPlugin (IDEA)

A session plugin works a bit different, the client starts a session using the plugin name:

client: use math
eizzek: Wellcome to Math plugin

from now on, all the messages typed are handled by the plugin:

client: 3 + 4
eizzek: 7
client: 4 * 3 - 10 / 2
eizzek: 7
client: end
eizzek: The Math plugin says goodbye

The API is shown below:

@session_plugin
class MathSessionPlugin(object):
    welcome = "Welcome to Math 
    help = "Use +, -, /, *"
    bye = "The Math plugin says goodbye"
    
    def answer(self, message):
        # return a string with your answer

note the use of decorators in classes, it's new in Python 2.6. If you're stuck with an older python version, you can register like this:

from eizzek.registry import registry

registry.session_plugin('math', MathSessionPlugin)

eizzek's People

Contributors

igorsobreira avatar

Stargazers

Andrews Medina avatar

Watchers

Andrews Medina avatar James Cloos 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.