Git Product home page Git Product logo

seejoo's Introduction

For list of commands offered by the bot, see help page.

seejoo

seejoo is an IRC utility bot coded in Python and built upon the Twisted networking library. Its main highlight is the extensible architecture: in most cases, new functionality can be added by implementing custom commands and plugins, rather than hacking the core code. This approach also allows for customizing the specific bot instance to meet one'a particular needs.

The name seejoo comes from the lojban word sidju which roughly means 'to help'.

Installation

For updating convenience it's recommended to use setup.py with develop parameter:

$ git clone git://github.com/Xion/seejoo.git
$ cd seejoo
$ sudo ./setup.py develop

This allows to simply git pull changes without having to run the setup.py script again.

Note: You will likely need to sudo the installation. If you are using a shell account and don't have root access, you can use virtualenv to create a personal copy of Python interpreter.

Running

seejoo.py is the startup that can be invoked directly:

$ ./seejoo.py

However, you will likely want to customize the bot by providing a YAML configuration file:

$ ./seejoo.py --config seejoo.yaml

See the attached example_config.yaml for supported config parameters.

Creating your own commands

(To be expanded.)

Creating your own plugins

Plugins are a more sophisticated way to extend the bot's functionality. They are small programs which are driven by the IRC-related events, such as someone joining a channel, saying something, changing channel's mode, and so on. Plugins get notified about those events and can respond to them.

From the Python point of view, plugins are simple callables which get called when an event happens. The simplest way to write a plugin is to subclass the seejoo.ext.Plugin class, which is shown at the example below:

from seejoo.ext import Plugin, plugin
from seejoo.util import irc
    
@plugin
class HelloResponder(Plugin):
    def message(self, bot, channel, user, message, msg_type):
        if not channel: return # Discarding non-channel messages
        
        # if user says something which resembles a greeting, respond to it
        msg = message.lower()
        if msg.startswith("hello") or msg.startswith("hi"):
            nick = irc.get_nick(user)
            response = "Hello %s!" % nick
            irc.say(bot, channel, response)

Note that the class is decorated to with @plugin decorator. This is required as in principle, plugins could also be normal functions.

For the list of interesting events you could handle in your plugin, see the definition of seejoo.ext.Plugin class.

seejoo's People

Contributors

xion avatar gosuwachu avatar

Watchers

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