====== Development Documentation ====== For API-Documentation See [[http://doc.otfbot.org/git/|API Documentation]] ===== Tech ===== we try to use consequently: * [[unicode]] * [[non-blocking]] I/O please read about the why and how. ===== some interesting topics explained ===== * [[callbacks]] * [[synced-join]] ===== How to create a (ircClient) plugin? ===== Have a look at our [[http://git.otfbot.org/otfbot.git/tree/examples/example.py|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 [[http://pypi.python.org/pypi/pep8|pep8]] Script to check your style.\\ [[http://vim.wikia.com/wiki/Highlight_long_lines|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" conditions((only if you really mean NEVER)), 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.