Documentation

InlineKeyboardButton extends KeyboardButton
in package

Class InlineKeyboardButton

Tags
link
https://core.telegram.org/bots/api#inlinekeyboardbutton

Table of Contents

__call()  : mixed|null
Return the variable for the called getter or magically set properties dynamically.
__construct()  : mixed
Entity constructor.
__toString()  : string
Perform to string
couldBe()  : bool
Check if the passed data array could be an InlineKeyboardButton.
escapeMarkdown()  : string
Escape markdown special characters
getBotUsername()  :
getCallbackData()  :
getCallbackGame()  :
getPay()  :
getProperty()  : mixed
Get a property from the current Entity
getRawData()  :
getRequestContact()  :
getRequestLocation()  :
getSwitchInlineQuery()  :
getSwitchInlineQueryCurrentChat()  :
getText()  :
getText()  :
getUrl()  :
setCallbackData()  :
setCallbackGame()  :
setPay()  :
setRequestContact()  :
setRequestLocation()  :
setSwitchInlineQuery()  :
setSwitchInlineQueryCurrentChat()  :
setText()  :
setText()  :
setUrl()  :
toJson()  : string
Perform to json
tryMention()  : string|null
Try to mention the user
assignMemberVariables()  : mixed
Helper to set member variables
makePrettyObjectArray()  : array<string|int, mixed>
Return an array of nice objects from an array of object arrays
subEntities()  : array<string|int, mixed>
Get the list of the properties that are themselves Entities
validate()  : mixed
Perform any special entity validation

Methods

__call()

Return the variable for the called getter or magically set properties dynamically.

public __call(mixed $method, mixed $args) : mixed|null
Parameters
$method : mixed
$args : mixed
Return values
mixed|null

__construct()

Entity constructor.

public __construct(array<string|int, mixed> $data[, string $bot_username = '' ]) : mixed
Parameters
$data : array<string|int, mixed>
$bot_username : string = ''
Tags
todo

Get rid of the $bot_username, it shouldn't be here!

throws
TelegramException
Return values
mixed

__toString()

Perform to string

public __toString() : string
Return values
string

couldBe()

Check if the passed data array could be an InlineKeyboardButton.

public static couldBe(array<string|int, mixed> $data) : bool
Parameters
$data : array<string|int, mixed>
Return values
bool

escapeMarkdown()

Escape markdown special characters

public escapeMarkdown(string $string) : string
Parameters
$string : string
Return values
string

getBotUsername()

public getBotUsername() :

Return the bot name passed to this entity

Return values

getCallbackData()

public getCallbackData() :

Optional. Data to be sent in a callback query to the bot when button is pressed, 1-64 bytes

Return values

getCallbackGame()

public getCallbackGame() :

Optional. Description of the game that will be launched when the user presses the button.

Return values

getPay()

public getPay() :

Optional. Specify True, to send a Pay button.

Return values

getProperty()

Get a property from the current Entity

public getProperty(mixed $property[, mixed $default = null ]) : mixed
Parameters
$property : mixed
$default : mixed = null
Return values
mixed

getRawData()

public getRawData() :

Get the raw data passed to this entity

Return values

getRequestContact()

public getRequestContact() :

Optional. If True, the user's phone number will be sent as a contact when the button is pressed. Available in private chats only

Return values

getRequestLocation()

public getRequestLocation() :

Optional. If True, the user's current location will be sent when the button is pressed. Available in private chats only

Return values

getSwitchInlineQuery()

public getSwitchInlineQuery() :

Optional. If set, pressing the button will prompt the user to select one of their chats, open that chat and insert the bot's username and the specified inline query in the input field. Can be empty, in which case just the bot’s username will be inserted.

Return values

getSwitchInlineQueryCurrentChat()

public getSwitchInlineQueryCurrentChat() :

Optional. If set, pressing the button will insert the bot‘s username and the specified inline query in the current chat's input field. Can be empty, in which case only the bot’s username will be inserted.

Return values

getText()

public getText() :

Text of the button. If none of the optional fields are used, it will be sent to the bot as a message when the button is pressed

Return values

getUrl()

public getUrl() :

Optional. HTTP url to be opened when button is pressed

Return values

setCallbackData()

public setCallbackData(string $callback_data) :

Optional. Data to be sent in a callback query to the bot when button is pressed, 1-64 bytes

Parameters
$callback_data : string
Return values

setCallbackGame()

public setCallbackGame(CallbackGame $callback_game) :

Optional. Description of the game that will be launched when the user presses the button.

Parameters
$callback_game : CallbackGame
Return values

setPay()

public setPay(bool $pay) :

Optional. Specify True, to send a Pay button.

Parameters
$pay : bool
Return values

setRequestContact()

public setRequestContact(bool $request_contact) :

Optional. If True, the user's phone number will be sent as a contact when the button is pressed. Available in private chats only

Parameters
$request_contact : bool
Return values

setRequestLocation()

public setRequestLocation(bool $request_location) :

Optional. If True, the user's current location will be sent when the button is pressed. Available in private chats only

Parameters
$request_location : bool
Return values

setSwitchInlineQuery()

public setSwitchInlineQuery(string $switch_inline_query) :

Optional. If set, pressing the button will prompt the user to select one of their chats, open that chat and insert the bot's username and the specified inline query in the input field. Can be empty, in which case just the bot’s username will be inserted.

Parameters
$switch_inline_query : string
Return values

setSwitchInlineQueryCurrentChat()

public setSwitchInlineQueryCurrentChat(string $switch_inline_query_current_chat) :

Optional. If set, pressing the button will insert the bot‘s username and the specified inline query in the current chat's input field. Can be empty, in which case only the bot’s username will be inserted.

Parameters
$switch_inline_query_current_chat : string
Return values

setText()

public setText(string $text) :

Text of the button. If none of the optional fields are used, it will be sent to the bot as a message when the button is pressed

Parameters
$text : string
Return values

setText()

public setText(string $text) :

Label text on the button

Parameters
$text : string
Return values

setUrl()

public setUrl(string $url) :

Optional. HTTP url to be opened when button is pressed

Parameters
$url : string
Return values

toJson()

Perform to json

public toJson() : string
Return values
string

tryMention()

Try to mention the user

public tryMention([bool $escape_markdown = false ]) : string|null

Mention the user with the username otherwise print first and last name if the $escape_markdown argument is true special characters are escaped from the output

Parameters
$escape_markdown : bool = false
Return values
string|null

assignMemberVariables()

Helper to set member variables

protected assignMemberVariables(array<string|int, mixed> $data) : mixed
Parameters
$data : array<string|int, mixed>
Return values
mixed

makePrettyObjectArray()

Return an array of nice objects from an array of object arrays

protected makePrettyObjectArray(string $class, string $property) : array<string|int, mixed>

This method is used to generate pretty object arrays mainly for PhotoSize and Entities object arrays.

Parameters
$class : string
$property : string
Return values
array<string|int, mixed>

subEntities()

Get the list of the properties that are themselves Entities

protected subEntities() : array<string|int, mixed>
Return values
array<string|int, mixed>

validate()

Perform any special entity validation

protected validate() : mixed
Return values
mixed

Search results