View Source ExGram.Dispatcher (ex_gram v0.53.0)

Named process that receive the updates, apply the middlewares for the bot and call the bot's handler

Summary

Types

@type custom_key() :: any()
@type parsed_message() ::
  {:command, key :: String.t() | custom_key(), ExGram.Model.Message.t()}
  | {:text, String.t(), ExGram.Model.Message.t()}
  | {:regex, key :: custom_key(), ExGram.Model.Message.t()}
  | {:location, ExGram.Model.Location.t()}
  | {:message, ExGram.Model.Message.t()}
  | {:callback_query, ExGram.Model.CallbackQuery.t()}
  | {:inline_query, ExGram.Model.InlineQuery.t()}
  | {:edited_message, ExGram.Model.Message.t()}
  | {:update, ExGram.Model.Update.t()}
@type t() :: %ExGram.Dispatcher{
  bot_info: ExGram.Model.User.t() | nil,
  commands: %{required(String.t()) => map()},
  dispatcher_name: atom(),
  error_handler: {module(), atom()},
  extra_info: map(),
  handler: {module(), atom()},
  middlewares: [ExGram.Bot.middleware()],
  name: atom(),
  regex: [Regex.t()]
}

Functions

Returns a specification to start this module under a supervisor.

See Supervisor.

Link to this function

init_state(name, bot_info, module, extra_info \\ %{})

View Source
@spec init_state(atom(), ExGram.Model.User.t() | nil, module(), map()) :: t()
@spec new(Enumerable.t()) :: t()
@spec start_link(t()) :: GenServer.on_start()