TelegramEx.Server (TelegramEx v1.3.0)

Copy Markdown View Source

GenServer that long-polls Telegram for updates and dispatches them to handlers.

This is started by the bot module child spec generated by use TelegramEx. See Getting Started and Routers.

Summary

Types

Internal server state.

Functions

Returns a specification to start this module under a supervisor.

Types

chat_id()

@type chat_id() :: TelegramEx.Types.chat_id()

state()

@type state() :: %{
  bot_module: module(),
  bot_name: atom(),
  token: String.t(),
  routers: [module()],
  offset: integer()
}

Internal server state.

Tracks bot configuration, routers, and current update offset for polling.

Functions

child_spec(init_arg)

Returns a specification to start this module under a supervisor.

See Supervisor.

start_link(bot_module, bot_name, routers \\ [])

@spec start_link(module(), atom(), [module()]) :: GenServer.on_start()