TelegramPHP Documentation

CallbackQueryBehaviour

Answering a button press.

Telegram shows a progress indicator on the button until the query is answered, so answer every callback query - even with nothing to say - and do it within a few seconds.

Tags
author

Valithor Obsidion valithor@valgorithms.com

Table of Contents

Methods

answer()  : PromiseInterface<string|int, bool>
Answers the query, optionally with a toast or an alert.
answerWithUrl()  : PromiseInterface<string|int, bool>
Answers by sending the user to a URL - a `t.me` link, or the game the button belongs to.
editMessage()  : PromiseInterface<string|int, Message|bool>
Edits the message the pressed button belongs to.

Methods

answer()

Answers the query, optionally with a toast or an alert.

public answer([?string $text = null ][, bool $showAlert = false ][, array<string, mixed> $options = [] ]) : PromiseInterface<string|int, bool>
Parameters
$text : ?string = null
$showAlert : bool = false
$options : array<string, mixed> = []

Any other answerCallbackQuery field.

Return values
PromiseInterface<string|int, bool>

answerWithUrl()

Answers by sending the user to a URL - a `t.me` link, or the game the button belongs to.

public answerWithUrl(string $url) : PromiseInterface<string|int, bool>
Parameters
$url : string
Return values
PromiseInterface<string|int, bool>

editMessage()

Edits the message the pressed button belongs to.

public editMessage(string $text[, array<string, mixed> $options = [] ]) : PromiseInterface<string|int, Message|bool>
Parameters
$text : string
$options : array<string, mixed> = []

Any other editMessageText field.

Return values
PromiseInterface<string|int, Message|bool>
On this page

Search results