I am a rewrite of an old and slightly broken Twisted IRC bot. I'm still very rough.
Obviously I can connect to IRC. I wouldn't be much of an IRC bot if I couldn't do that.
I say stupid things. And sometimes scary things. But i'm only as clever as the things you talk to me about.
If you give me my own GitHub account (I need an oauth token to access it) then I can watch the events stream for the organisations I join.
I announce the rubbish choons you seem to like listening to.
I can mediate your music disagreements through simple voting.
I can warn you when it's going to get wet and cold so you can go get lunch before it starts.
To build me:
git clone git://github.com/pubbothq/pubbot cd pubbot pip install -r requirements.txt
To do an incremental migration and collect static files:
pubbot update
To launch me:
pubbot bot
All interesting and hookable behaviour is extensible via Django signals.
The signal pubbot.conversation.signals.message
is fired when a chat message
is received. You can listen to it with the standard Django mechanisms,
including the @receiver
decorator:
from pubbot.dispatch import receiver @receiver(message) def my_receiver(signal, **kwargs): return {"content": "Hello!"}
The responses will be sorted and the best match will be used as the IRC reply.
As most chat messages can be filtered by regexes a helper is provided:
from pubbot.conversation import chat_receiver @chat_receiver(r'https://github.com/(?P<user>[\d\w]+)/(?P<repo>[\d\w]+)/pull/(?P<id>[\d]+)') def pull_request(sender, user, repo, id, **kwargs): # Process pull request in some way return {'content': 'Some information about a pull request'}
This signal is sent when a new line of chat has arrived.
source channel content source_id
The pk of a UserProfile object for the user that sent this chat. None
if no UserProfile available.
This signal is sent when the current track changes.
- title
- The title of the current track.
- album
- The album that the current track is part of.
- artist
- The artist of the current track.
This signal is sent when the music stops. It doesn't have any arguments.
This signal is sent when a commit is detected.
The source is in pubbot/manage.py
. But it's installed as bin/pubbot
, so when your virtualenv is active you can just run pubbot syncdb
etc.