Builder for document payloads.
Supports URLs, local file paths, captions, parse modes, and silent sends. See Messages and Media.
Summary
Functions
Sets the document caption.
Sets the document caption with parse mode.
Sets the document from a local file path.
Sends the document to the specified chat.
Sends the document without notification sound.
Sets the document from a URL.
Types
@type input() :: map() | TelegramEx.Effect.t()
Functions
@spec caption(input(), String.t()) :: TelegramEx.Effect.t()
Sets the document caption.
Accepts a handler context or an existing TelegramEx.Effect and returns an
effect with :caption stored in the payload.
Parameters
input- Context map or effectcaption- Caption text
Returns
TelegramEx.Effect with :caption stored in the payload.
@spec caption(input(), String.t(), String.t()) :: TelegramEx.Effect.t()
Sets the document caption with parse mode.
Accepts a handler context or an existing TelegramEx.Effect and returns an
effect with :caption and :parse_mode stored in the payload.
Parameters
input- Context map or effectcaption- Caption textparse_mode- Parse mode ("Markdown", "MarkdownV2", or "HTML")
Returns
TelegramEx.Effect with :caption and :parse_mode stored in the payload.
@spec path(input(), String.t()) :: TelegramEx.Effect.t()
Sets the document from a local file path.
If the file cannot be read, the returned effect contains
{:file, reason} as its error.
Parameters
input- Context map or effectpath- Path to the document file
Returns
TelegramEx.Effect with :document stored in the payload, or a file-read
error.
@spec send(input(), integer()) :: TelegramEx.Effect.t()
Sends the document to the specified chat.
The returned effect contains an API error if the request fails.
Parameters
input- Context map or effect with accumulated document dataid- Chat ID to send the document to
Returns
TelegramEx.Effect with the request result encoded in the effect state.
@spec silent(input()) :: TelegramEx.Effect.t()
Sends the document without notification sound.
Accepts a handler context or an existing TelegramEx.Effect and returns an
effect with :disable_notification stored in the payload.
Parameters
input- Context map or effect
Returns
TelegramEx.Effect with :disable_notification stored in the payload.
@spec url(input(), String.t()) :: TelegramEx.Effect.t()
Sets the document from a URL.
Accepts a handler context or an existing TelegramEx.Effect and returns an
effect with :document stored in the payload.
Parameters
input- Context map or effecturl- URL of the document
Returns
TelegramEx.Effect with :document stored in the payload.