Struct representing a Telegram CallbackQuery object.
A callback query is created when a user presses an inline keyboard button. It contains information about the button pressed and the message it was attached to.
Fields
:id- Unique identifier for the callback query:from- User who triggered the callback (map with string keys):message- TheTelegramEx.Types.Messagethe callback was attached to:inline_message_id- Identifier of the inline message (if applicable):chat_instance- Global identifier for the chat:data- Data associated with the callback button:message_thread_id- Thread ID for forum chats (if applicable)
Examples
def handle_callback(%CallbackQuery{data: "confirm"} = callback, ctx) do
ctx
|> Message.text("Confirmed!")
|> Message.answer_callback_query(callback)
|> Message.send(callback.message.chat["id"])
end
Summary
Functions
Converts a raw Telegram API callback query map to a CallbackQuery struct.
Types
@type t() :: %TelegramEx.Types.CallbackQuery{ chat_instance: String.t(), data: String.t(), from: map(), id: String.t(), inline_message_id: String.t() | nil, message: TelegramEx.Types.Message.t() | nil, message_thread_id: integer() | nil }
CallbackQuery struct type.
Contains all fields from a Telegram callback query update.
Functions
Converts a raw Telegram API callback query map to a CallbackQuery struct.
Parameters
map- Raw callback query map from Telegram API
Returns
A TelegramEx.Types.CallbackQuery struct.
Examples
iex> CallbackQuery.from_map(%{"id" => "123", "data" => "confirm", ...})
%TelegramEx.Types.CallbackQuery{id: "123", data: "confirm", ...}