InlineKeyboard
extends Keyboard
in package
Class InlineKeyboard
Tags
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
- addRow() : $this
- Create a new row in keyboard and add buttons.
- escapeMarkdown() : string
- Escape markdown special characters
- forceReply() : Keyboard
- Display a reply interface to the user (act as if the user has selected the bot's message and tapped 'Reply').
- getBotUsername() :
- getKeyboardButtonClass() : KeyboardButton|InlineKeyboardButton
- Get the proper keyboard button class for this keyboard.
- getKeyboardType() : string
- Get the type of keyboard, either "inline_keyboard" or "keyboard".
- getOneTimeKeyboard() :
- getProperty() : mixed
- Get a property from the current Entity
- getRawData() :
- getResizeKeyboard() :
- getSelective() :
- isInlineKeyboard() : bool
- If this keyboard is an inline keyboard.
- remove() : Keyboard
- Remove the current custom keyboard and display the default letter-keyboard.
- setOneTimeKeyboard() :
- setResizeKeyboard() :
- setSelective() :
- toJson() : string
- Perform to json
- tryMention() : string|null
- Try to mention the user
- assignMemberVariables() : mixed
- Helper to set member variables
- createFromParams() : array<string|int, mixed>
- If no explicit keyboard is passed, try to create one from the parameters.
- makePrettyObjectArray() : array<string|int, mixed>
- Return an array of nice objects from an array of object arrays
- parseButton() : KeyboardButton|null
- Parse a given button to the correct KeyboardButton object type.
- parseRow() : array<string|int, mixed>
- Parse a given row to the correct array format.
- 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( $method, $args) : mixed|null
Parameters
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
Return values
mixed —__toString()
Perform to string
public
__toString() : string
Return values
string —addRow()
Create a new row in keyboard and add buttons.
public
addRow() : $this
Return values
$this —escapeMarkdown()
Escape markdown special characters
public
escapeMarkdown(string $string) : string
Parameters
- $string : string
Return values
string —forceReply()
Display a reply interface to the user (act as if the user has selected the bot's message and tapped 'Reply').
public
static forceReply([array<string|int, mixed> $data = [] ]) : Keyboard
Parameters
- $data : array<string|int, mixed> = []
Tags
Return values
Keyboard —getBotUsername()
public
getBotUsername() :
Return the bot name passed to this entity
Return values
—getKeyboardButtonClass()
Get the proper keyboard button class for this keyboard.
public
getKeyboardButtonClass() : KeyboardButton|InlineKeyboardButton
Return values
KeyboardButton|InlineKeyboardButton —getKeyboardType()
Get the type of keyboard, either "inline_keyboard" or "keyboard".
public
getKeyboardType() : string
Return values
string —getOneTimeKeyboard()
public
getOneTimeKeyboard() :
Optional. Requests clients to remove the keyboard as soon as it's been used. The keyboard will still be available, but clients will automatically display the usual letter-keyboard in the chat – the user can press a special button in the input field to see the custom keyboard again. Defaults to false.
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
—getResizeKeyboard()
public
getResizeKeyboard() :
Optional. Requests clients to resize the keyboard vertically for optimal fit (e.g., make the keyboard smaller if there are just two rows of buttons). Defaults to false, in which case the custom keyboard is always of the same height as the app's standard keyboard.
Return values
—getSelective()
public
getSelective() :
Optional. Use this parameter if you want to show the keyboard to specific users only. Targets: 1) users that are @mentioned in the text of the Message object; 2) if the bot's message is a reply (has reply_to_message_id), sender of the original message.
Return values
—isInlineKeyboard()
If this keyboard is an inline keyboard.
public
isInlineKeyboard() : bool
Return values
bool —remove()
Remove the current custom keyboard and display the default letter-keyboard.
public
static remove([array<string|int, mixed> $data = [] ]) : Keyboard
Parameters
- $data : array<string|int, mixed> = []
Tags
Return values
Keyboard —setOneTimeKeyboard()
public
setOneTimeKeyboard(bool $one_time_keyboard) :
Optional. Requests clients to remove the keyboard as soon as it's been used. The keyboard will still be available, but clients will automatically display the usual letter-keyboard in the chat – the user can press a special button in the input field to see the custom keyboard again. Defaults to false.
Parameters
- $one_time_keyboard : bool
Return values
—setResizeKeyboard()
public
setResizeKeyboard(bool $resize_keyboard) :
Optional. Requests clients to resize the keyboard vertically for optimal fit (e.g., make the keyboard smaller if there are just two rows of buttons). Defaults to false, in which case the custom keyboard is always of the same height as the app's standard keyboard.
Parameters
- $resize_keyboard : bool
Return values
—setSelective()
public
setSelective(bool $selective) :
Optional. Use this parameter if you want to show the keyboard to specific users only. Targets: 1) users that are @mentioned in the text of the Message object; 2) if the bot's message is a reply (has reply_to_message_id), sender of the original message.
Parameters
- $selective : bool
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 —createFromParams()
If no explicit keyboard is passed, try to create one from the parameters.
protected
createFromParams() : array<string|int, mixed>
Return values
array<string|int, 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> —parseButton()
Parse a given button to the correct KeyboardButton object type.
protected
parseButton(array<string|int, mixed>|string|KeyboardButton $button) : KeyboardButton|null
Parameters
- $button : array<string|int, mixed>|string|KeyboardButton
Return values
KeyboardButton|null —parseRow()
Parse a given row to the correct array format.
protected
parseRow(array<string|int, mixed> $row) : array<string|int, mixed>
Parameters
- $row : array<string|int, mixed>
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