Skip to main content

IRC bot - full featured, yet extensible and customizable

Project description

-*- restructuredtext -*-

======
pmxbot
======

pmxbot is an IRC bot written in python. Originally built for internal use,
it's been sanitized and set free upon the world.


Commands
========
pmxbot listens to commands prefixed by a '!'
If it's a command it knows it will reply, take an action, etc.
It can search the web, quote you, track karma, make decisions,
and do just about anything else you could want. It logs text in a sqlite3
database, and eventually we'll write a web interface to it.

Contains
========
pmxbot will respond to things you say if it detects words and phrases it's
been told to recognize. For example, mention sql on rails.

Requirements
============
pmxbot requires python, of course. Probably 2.5+. It also requires a few python
packages:

* python-irclib
* pyyaml
* simplejson or json
* feedparser
* httplib2
* sqlite3

Optionally nosetests for the test suite.

The web interface requires cherrypy and jinja2.

Testing
=======
We have a basic nose test suite that does some functional tests with an
included TCL IRC daemon, and some basic unit tests as well. Just run them from
the pmxbot root directory with "nosetests" and it should do it all for you.
You'll need TCL and nosetests to do it though.

Configuration
=============
Configuration is based on very easy YAML files. Check out config.yaml in the
source tree for an example.

Usage
=====
Once you've setup a config file, you just need to call ``pmxbot config.yaml``
and it will join and connect. We recommend running pmxbot under djb's
daemontools to make it automatically restart if it crashes.


Adding a custom, local feature
==============================
Adding a new feature is easy, you just need to add them to a local_extensions
file, following the established convention. The files to load are specified
in the local_extensions configuration setting. All files in the list are run
with execfile, so they inherit the existing globals. As a result you can
assume that most things you'll need are already imported, like @command,
@contains, re, urllib, httplib2 and get_html. There's an example in local.py
that you can use as the basis for yours..

A command (!g) gets the @command deocator::

@command("tinytear", aliases=('tt', 'tear', 'cry'), doc="I cry a tiny tear \
for you.")
def tinytear(client, event, channel, nick, rest):
if rest:
return "/me sheds a single tear for %s" % rest
else:
return "/me sits and cries as a single tear slowly trickles down its \
cheek"

A response (when someone says something) uses the @contains decorator::

@contains("sqlonrails")
def yay_sor(client, event, channel, nick, rest):
karmaChange(botbase.logger.db, 'sql on rails', 1)
return "Only 76,417 lines..."

Web Interface
=============
pmxbot includes a web server for allowing users to view the logs, read the
help, and check karma. You specify the host, port, base path, logo, title,
etc with the same YAML config file. Just run like ``pmxbotweb config.yaml``
and it will start up. I suggest using a tool like supervisor, daemontools,
cherryd or somesuch to keep it running.

Project details


Release history Release notifications | RSS feed

This version

1004

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pmxbot-1004.tar.gz (2.0 MB view details)

Uploaded Source

File details

Details for the file pmxbot-1004.tar.gz.

File metadata

  • Download URL: pmxbot-1004.tar.gz
  • Upload date:
  • Size: 2.0 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for pmxbot-1004.tar.gz
Algorithm Hash digest
SHA256 503db37aace4ed064ee3bbae654ea593676ec2a1cf1446f57975303e3604c064
MD5 d75668030e8483c6ce68595ce2e6f10c
BLAKE2b-256 bbc74b0f6f614c7e35ed25d77e1208fdb060f3eec12268872f48e8769b5a3ddb

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page