Skip to content

Listeners Compiler

The compiler in lilybird is what makes our api possible, it builds all the listeners once at startup so you only get both, what you defined and with proper transformers (if present) without any runtime checks after the bot starts.

The lack of this extra checks on every event is what makes lilybird so fast, the workflow is just
event -> listener with the only thing possibly in the middle being the transformers you define or in some cases the cache code.

overview

The great advantage of the compiler is that your listeners run smoothly without having to do any checks because it does all the checks when its compiling them.

Lets look at the following diagram:

compiler

This illustrates how the compiler analyses your options and creates each listener, all the checks it does occur only once so during runtime each listener runs its own straight line without any checks.