shellbot.updaters.file module

class shellbot.updaters.file.FileUpdater(engine=None, **kwargs)[source]

Bases: shellbot.updaters.base.Updater

Writes inbound events to a file

This updater serializes events and write JSON records to a flat file.

An event may be a Message, a Join or Leave notification, or any other Event.

Updaters expose a filtering function that can be connected to the inbound flow of events handled by the Listener.

Example:

updater = FileUpdater(path='/var/log/my_app.log')
listener = Listener(filter=updater.filter)
get_path()[source]

Provides the path to the target file

Return type:str
on_bond(bot)[source]

Creates path on space bonding

on_init(path=None, **kwargs)[source]

Writes inbound events to a file

put(event)[source]

Processes one event

Parameters:event (Event or Message or Join or Leave) – inbound event

The function serializes the event and write it to a file.