Skip to content
qll edited this page Sep 15, 2014 · 8 revisions

Modules are the main way to extend qllbot's functionality. They are files in the modules/ directory and contain commands and event listeners. Commands can be executed with the #command parameters syntax in an IRC channel or private message. Event listeners are invoked when certain events occur (e.g. a message in an IRC channel). Every module with the file extension .py will be automatically loaded by qllbot. To stop qllbot from loading such a file, prefix it with a "_" (so fun.py would become _fun.py).

Go ahead and take a look into one of the module files. If you are familiar with Python, they should be mostly self-explanatory. Do you see the @lib.cmd.command decorator above some function definitions? This is all you need to register a function as a command, which can then be called with #function_name. Docstrings will be used by the #help COMMAND to show a helpful text.

Event listeners are a more powerful than commands. They do not have to be invoked by a command character. Look into the youtube.py module to see an example of that. In fact, command invocation is realized with event listeners (if you want to see the details, look into lib/core_events.py). A list of events and their parameters can be found here.

Now let's get started: Write a command

Clone this wiki locally