Aleph, version 1.1.0
07 Feb 2012Aleph version 1.1 brings the CallbackBot class, which is now the default instance of Aleph.
It’s the first version that allows a bot to be made without subclassing any of the core classes and can be instantiated using only the configuration.
The ‘callbacks’ config item should be a list or other iterable of tuples containing (message, function), where message is a string or list of strings that name Message types - when one of these message types is generated by an incoming message, the function is called with the Message instance.
Example script:
:::python
#!/usr/bin/python
import aleph
bot = aleph.Aleph({
'nick' : 'AlephExampleBot',
'servers' : [{
'id': 'AFNet',
'address': 'irc.aberwiki.org',
'channels': ['#aleph']
}],
'callbacks' : [
('PRIVATE', lambda message: message.reply('Oh my!')),
('PRIVMSG', lambda message: message.reply('Hello!')),
],
}).run()