TelegramEx.Builder.Sticker (TelegramEx v1.2.1)

Copy Markdown View Source

Builder for sticker payloads.

This module provides a fluent API for sending stickers from Telegram file IDs, URLs, or local file paths.

Examples

# Send sticker by file ID
ctx
|> Sticker.id("CAACAgIAAxkBA...")
|> Sticker.send(chat_id)

# Send sticker from URL
ctx
|> Sticker.url("https://example.com/sticker.webp")
|> Sticker.send(chat_id)

# Send sticker from local file
ctx
|> Sticker.path("/tmp/sticker.webp")
|> Sticker.send(chat_id)

Summary

Functions

Sets the sticker by Telegram file ID.

Sets the sticker from a local file path.

Sends the sticker to the specified chat.

Sends the sticker without notification sound.

Sets the sticker from a URL.

Functions

id(ctx, id)

@spec id(map(), String.t()) :: map()

Sets the sticker by Telegram file ID.

Parameters

  • ctx - Context map
  • id - Telegram file ID of the sticker

Returns

Updated context map with sticker ID set.

path(ctx, path)

@spec path(map(), String.t()) :: map()

Sets the sticker from a local file path.

Parameters

  • ctx - Context map
  • path - Path to the sticker file

Returns

Updated context map with sticker file content set.

send(ctx, id)

@spec send(map(), integer()) :: :ok | {:error, term()}

Sends the sticker to the specified chat.

Parameters

  • ctx - Context map with accumulated sticker data
  • id - Chat ID to send the sticker to

Returns

  • :ok - Sticker sent successfully
  • {:error, reason} - Failed to send sticker

silent(ctx)

@spec silent(map()) :: map()

Sends the sticker without notification sound.

Parameters

  • ctx - Context map

Returns

Updated context map with silent flag set.

url(ctx, url)

@spec url(map(), String.t()) :: map()

Sets the sticker from a URL.

Parameters

  • ctx - Context map
  • url - URL of the sticker

Returns

Updated context map with sticker URL set.