TelegramEx.Router behaviour (TelegramEx v1.3.0)

Copy Markdown View Source

Behaviour for organizing bot handlers into separate modules.

Routers are tried before the main bot module and can define message handlers, callback handlers, FSM states, and commands. See Routers.

Summary

Callbacks

Callback invoked when a callback query is received.

Callback invoked when a message is received.

Callbacks

handle_callback(callback, ctx)

@callback handle_callback(callback :: TelegramEx.Types.CallbackQuery.t(), ctx :: map()) ::
  any()

Callback invoked when a callback query is received.

Should return a TelegramEx.handler_result() or :pass to skip to the next handler.

handle_message(message, ctx)

@callback handle_message(message :: TelegramEx.Types.Message.t(), ctx :: map()) :: any()

Callback invoked when a message is received.

Should return a TelegramEx.handler_result() or :pass to skip to the next handler.