Python IRCBot module(last modified: 26 December, '06)
A high level interface to the IRC network
ircbot.py provides you with a very simple framework with which to write your bots. If you want to really program your own bot, or just want something super lightweight with which to do simple things (e.g controlling a webserver, etc) instead of writing plugins for supybot, then this could be just right for you. Written a couple of years ago, but it seems to work as good as ever :-). A full example of a bot that responds when someone says 'hello' in a channel it resides in would be as follows:
| 1 | import ircbot |
| 2 | class HelloBot(ircbot.IRCBot): |
| 3 | def messageFromChannel(self, channel, user, message): |
| 4 | if message.startswith("hello"): |
| 5 | self.sendMessageToChannel(channel, "Hello to you too " + user + "!") |
| 6 | |
| 7 | bot = HelloBot("HelloBot", "irc.freenode.net", ["#hellobot"]) |
| 8 | bot.execute() |
| 9 | bot.close() |
It's all commented with epytext docstrings (seemed like a good idea at a time, heh) so you can generate some documentation for it using epydoc.
Marvin icon by Everaldo.
Download
(or view the source online)