Reference: Handlers

The following handlers are build into of mechanical bull.

async mechanical_bull.actions.accept_follow_request.handle(client: BovineClient, data: dict)[source]

Automatically accepts follow requests. Include via

[username.handlers]
"mechanical_bull.actions.accept_follow_request" = true
async mechanical_bull.actions.reject_follow_request.handle(client: BovineClient, data: dict)[source]

Automatically rejects follow requests. Include via

[username.handlers]
"mechanical_bull.actions.reject_follow_request" = true
async mechanical_bull.actions.announce.handle(client: BovineClient, data: dict, activties_to_announce_object: List[str] = [], only_announce: List[str] | None = None, ignored_activities: List[str] = [])[source]

Automatically announces objects. Announces are public. In order to allow for non public announces, one probably needs FEP-8b32 as discussed here.

[username.handlers."mechanical_bull.actions.announce"]
activties_to_announce_object = ["Create"]
only_announce = ["Create"]

[username.handlers."mechanical_bull.actions.announce"]
ignored_activities = ["Block"]

The first configuration will cause the handler to announce an object of a create. This behavior is similar to the behavior of boosting every toot on Mastodon. The second configuration is similar to what Lemmy does.

To use as a handler in python code use

from functools import partial

values = {"ignored_activities": ["Block"]}
return partial(handle, **value)
async mechanical_bull.actions.log_to_file.handle(actor: BovineClient, data: dict, filename=None) None[source]

Logs all activity to the file given by filename. To use in your configuration file use

[username.handlers."mechanical_bull.actions.log_to_file"]
filename = "logfile.txt"

To use as a handler in python code use

from functools import partial

values = {"filename": "logfile.txt"}
return partial(func, **value)