Development Documentation

For API-Documentation See API Documentation

Tech

we try to use consequently:

please read about the why and how.

some interesting topics explained

How to create a (ircClient) plugin?

Have a look at our example plugin to see which callbacks exist. you can react on each of those as you like using python code.

The most simple plugin is just

from otfbot.lib import chatMod
from otfbot.lib.pluginSupport.decorators import callback

class Plugin(chatMod.chatMod):
    @callback
    def command(self, user, channel, cmd, options):
        """just echo every line back to channel"""
        self.bot.sendmsg(channel, "Command %s with options %s"%(cmd, options))

for other services do NOT use chatMod but pluginsupport.plugin.Plugin as baseclass.

Style Guide

Source-Style: Use the pep8 Script to check your style.
highlight long lines in vim

References: try to use simple and understandable paths when referencing some service/plugin. self.root is better than self.parent.parent.parent. self.parent is better than self.root.getNamedService('someservice').bla if the service is the parent.

Logging: use logger.error ONLY for messages, which should be reported as bugs. Exceptions, “this should never happen” conditions1), etc.

Testing

unit-tests are great, doc-tests are good. but most functions can only be human-tested because of the nature of an IRC bot. if you tested your plugin successfully, make an entry at the tests page, so we know which reversion worked, and that it was successfully tested.

1) only if you really mean NEVER