Botlead.Client.Behaviour behaviour (botlead v0.3.0)

Callback which require implementation by custom bot clients.

Summary

Callbacks

Default state for client session.

Name generator for client session servers.

Callback for handling message delivery, replaces the current state.

Transform new message from bot into connection object. The place to put routing business logic.

Module for message routing.

Types

delivery_action()

@type delivery_action() :: :sent | :edited | :deleted

message()

@type message() :: map()

state()

@type state() :: map()

Callbacks

get_initial_state(t, t)

@callback get_initial_state(String.t(), Keyword.t()) :: state()

Default state for client session.

instance(t)

@callback instance(String.t()) :: atom()

Name generator for client session servers.

message_delivered(delivery_action, message, state)

@callback message_delivered(delivery_action(), message(), state()) :: state()

Callback for handling message delivery, replaces the current state.

message_to_conn(message, state, t)

@callback message_to_conn(message(), state(), Keyword.t()) :: GenRouter.Conn.t()

Transform new message from bot into connection object. The place to put routing business logic.

router()

@callback router() :: module()

Module for message routing.