ExGram.Handler behaviour (ex_gram v0.65.0)

Copy Markdown View Source

Behaviour for handling updates in ExGram.Bot implementations.

Implement this behaviour in your bot module to handle incoming updates from Telegram. The handle/2 callback receives parsed messages and a context struct, while handle_error/1 handles any errors that occur during message processing.

See the Handling Updates guide for more details.

Summary

Types

init_opts()

@type init_opts() :: [bot: atom() | String.t(), token: String.t(), extra_info: map()]

Callbacks

handle(parsed_message, t)

(optional)

handle_error(t)

(optional)
@callback handle_error(ExGram.Error.t()) :: any()

init(init_opts)

@callback init(init_opts()) :: :ok