User
This object represents a Bale user or bot.
📝 Schema
Field | Type | Description |
---|---|---|
id | int | Unique identifier for this user or bot. This number may have more than 32 significant bits and some programming languages may have difficulty/silent defects in interpreting it. But it has at most 52 significant bits, so a 64-bit integer or double-precision float type are safe for storing this identifier. |
is_bot | bool | True , if this user is a bot |
first_name | string | User's or bot's first name. |
last_name | string | Optional. User's or bot's last name. |
username | string | Optional. User's or bot's username. |
language_code | string | Optional. IETF language tag of the user's language |
NOTE
While the official Bale documentation states that the language_code
field is part of the User object, the Bale API itself does not include this field in its responses. Be mindful of this discrepancy when designing your application.
⚙️ Get methods
getId()
Retrieves the User ID.
$userId = $userObject->getId();
getIsBot()
Checks if the user is a bot.
$userIsBot = $userObject->getIsBot();
getFirstName()
Retrieves the first name of the user.
$userFirstName = $userObject->getFirstName();
getLastName()
Retrieves the last name of the user (if available).
$userLastName = $userObject->getLastName();
getUsername()
Retrieves the username of the user (if available).
$userUsername = $userObject->getUsername();
getLanguageCode()
Retrieves the language code associated with the user's language (if available).
$userLanguageCode = $userObject->getLanguageCode();
➕ More
tip
For further information, refer to the official Bale documentation for more details.