Event Reference¶
You can register an event using the event() decorator using your Plugin instance. For example:
@plugin.event
async def on_initialization():
...
Alternatively, you can use the register_event() method to manually register events. For example:
async def my_event():
...
plugin.register_event(my_event, name="on_initialization")
Warning
All the events must be a coroutine. If they aren’t, then you might get unexpected
errors. In order to turn a function into a coroutine they must be async def
functions.
API Events¶
These events are serialized versions of the raw api events
on_initialization¶
- async def on_initialization()
This function is a coroutine.
This is called when flow sends the
initializerequest, which happens when the plugin gets started for the first time.
on_close¶
- async def on_close()
This function is a coroutine.
This is called when flow attempts to gracefully shut down.
Warning
Not sending a response in this event WILL cause flow to deadlock. Any response will do, even and error response.
Error Handling Events¶
These events are triggered by flogin to handle errors
on_error¶
- async def on_error(event, error, *args, **kwargs)
This function is a coroutine.
This is called when an error occurs inside of another event.
- Parameters:
- Returns:
Any valid response object for the given event
- Return type: