User
extends Part
in package
uses
UserBehaviour
This file is generated from spec/openapi.json (Bot API 10.3) by tools/generate.php.
Do not edit it by hand - run composer spec:build instead.
This object represents a Telegram user or bot.
Tags
Table of Contents
Constants
- DISCRIMINATOR : mixed = null
- The attribute whose value names the concrete subtype, for union parents.
- SUBTYPES : array<string, Part>>|array<int, Part>> = []
- The concrete classes a union parent may resolve to - keyed by discriminator value when there is one, a plain list otherwise. Empty on ordinary parts.
Properties
- $added_to_attachment_menu : bool|null
- $allows_users_to_create_topics : bool|null
- $can_connect_to_business : bool|null
- $can_join_groups : bool|null
- $can_manage_bots : bool|null
- $can_read_all_group_messages : bool|null
- $first_name : string
- $has_main_web_app : bool|null
- $has_topics_enabled : bool|null
- $id : int
- $is_bot : bool
- $is_premium : bool|null
- $language_code : string|null
- $last_name : string|null
- $supports_guest_queries : bool|null
- $supports_inline_queries : bool|null
- $supports_join_request_queries : bool|null
- $username : string|null
- $casts : array<string, string>
- Attribute name => Telegram type token ("User", "Array of PhotoSize"), used to hydrate nested objects into parts.
- $dates : array<int, string>
- Attribute names holding Unix timestamps, read back as {@see CarbonImmutable}.
- $fillable : array<int, string>
- Attribute names this part accepts. Empty = accept anything.
- $telegram : Telegram
Methods
- __construct() : mixed
- __debugInfo() : array<string, mixed>
- __get() : mixed
- __isset() : bool
- __set() : void
- __toString() : string
- attributeExists() : bool
- fill() : void
- getAttribute() : mixed
- getCasts() : array<string, string>
- getFillable() : array<int, string>
- getFullName() : string
- First and last name, joined - the name Telegram shows.
- getHandle() : string
- `@username` when they have one, their display name otherwise.
- getProfilePhotos() : PromiseInterface<string|int, UserProfilePhotos>
- This user's profile photos.
- getRawAttributes() : array<string, mixed>
- getTelegram() : Telegram
- jsonSerialize() : array<string, mixed>
- The payload this part would be sent back to Telegram as - nested parts and collections flattened, timestamps left as the integers they arrived as.
- mention() : string
- A Markdown or HTML mention that links to this user, which works even when they have no username.
- offsetExists() : bool
- offsetGet() : mixed
- offsetSet() : void
- offsetUnset() : void
- resolveSubtype() : Part>
- The concrete class an incoming payload belongs to, for a union parent.
- sendMessage() : PromiseInterface<string|int, Message>
- Messages this user directly.
- setAttribute() : void
- factory() : Factory
- Builds another part from the same client - for nested objects.
- getRawAttribute() : mixed
- Reads straight from the attribute bag, skipping the `get{Key}Attribute` hook.
- setRawAttribute() : void
- Writes straight to the attribute bag, skipping the `set{Key}Attribute` hook and any cast. For use *inside* a mutator, which would otherwise have no way to store its shaped value without recursing through {@see setAttribute()}.
Constants
DISCRIMINATOR
The attribute whose value names the concrete subtype, for union parents.
public
mixed
DISCRIMINATOR
= null
null on ordinary parts and on unions Telegram does not tag.
SUBTYPES
The concrete classes a union parent may resolve to - keyed by discriminator value when there is one, a plain list otherwise. Empty on ordinary parts.
public
array<string, Part>>|array<int, Part>>
SUBTYPES
= []
Properties
$added_to_attachment_menu
public
bool|null
$added_to_attachment_menu
Optional. True, if this user added the bot to the attachment menu
$allows_users_to_create_topics
public
bool|null
$allows_users_to_create_topics
Optional. True, if the bot allows users to create and delete topics in private chats. Returned only in getMe.
$can_connect_to_business
public
bool|null
$can_connect_to_business
Optional. True, if the bot can be connected to a user account to manage it. Returned only in getMe.
$can_join_groups
public
bool|null
$can_join_groups
Optional. True, if the bot can be invited to groups. Returned only in getMe.
$can_manage_bots
public
bool|null
$can_manage_bots
Optional. True, if other bots can be created to be controlled by the bot. Returned only in getMe.
$can_read_all_group_messages
public
bool|null
$can_read_all_group_messages
Optional. True, if privacy mode is disabled for the bot. Returned only in getMe.
$first_name
public
string
$first_name
User's or bot's first name
$has_main_web_app
public
bool|null
$has_main_web_app
Optional. True, if the bot has a main Web App. Returned only in getMe.
$has_topics_enabled
public
bool|null
$has_topics_enabled
Optional. True, if the bot has forum topic mode enabled in private chats. Returned only in getMe.
$id
public
int
$id
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
public
bool
$is_bot
True, if this user is a bot
$is_premium
public
bool|null
$is_premium
Optional. True, if this user is a Telegram Premium user
$language_code
public
string|null
$language_code
Optional. IETF language tag of the user's language
$last_name
public
string|null
$last_name
Optional. User's or bot's last name
$supports_guest_queries
public
bool|null
$supports_guest_queries
Optional. True, if the bot supports guest queries from chats it is not a member of. Returned only in getMe.
$supports_inline_queries
public
bool|null
$supports_inline_queries
Optional. True, if the bot supports inline queries. Returned only in getMe.
$supports_join_request_queries
public
bool|null
$supports_join_request_queries
Optional. True, if the bot supports join request queries and can be assigned to process them. Returned only in getMe.
$username
public
string|null
$username
Optional. User's or bot's username
$casts
Attribute name => Telegram type token ("User", "Array of PhotoSize"), used to hydrate nested objects into parts.
protected
array<string, string>
$casts
= []
$dates
Attribute names holding Unix timestamps, read back as {@see CarbonImmutable}.
protected
array<int, string>
$dates
= []
$fillable
Attribute names this part accepts. Empty = accept anything.
protected
array<int, string>
$fillable
= ['id', 'is_bot', 'first_name', 'last_name', 'username', 'language_code', 'is_premium', 'added_to_attachment_menu', 'can_join_groups', 'can_read_all_group_messages', 'supports_guest_queries', 'supports_inline_queries', 'can_connect_to_business', 'has_main_web_app', 'has_topics_enabled', 'allows_users_to_create_topics', 'can_manage_bots', 'supports_join_request_queries']
$telegram read-only
protected
Telegram
$telegram
Methods
__construct()
public
__construct(Telegram $telegram[, array<string, mixed>|object $attributes = [] ]) : mixed
Parameters
- $telegram : Telegram
- $attributes : array<string, mixed>|object = []
__debugInfo()
public
__debugInfo() : array<string, mixed>
Return values
array<string, mixed>__get()
public
__get(string $name) : mixed
Parameters
- $name : string
__isset()
public
__isset(string $name) : bool
Parameters
- $name : string
Return values
bool__set()
public
__set(string $name, mixed $value) : void
Parameters
- $name : string
- $value : mixed
__toString()
public
__toString() : string
Return values
stringattributeExists()
public
attributeExists(string $key) : bool
Parameters
- $key : string
Return values
boolfill()
public
fill(array<string, mixed> $attributes) : void
Parameters
- $attributes : array<string, mixed>
getAttribute()
public
getAttribute(string $key) : mixed
Parameters
- $key : string
getCasts()
public
getCasts() : array<string, string>
Return values
array<string, string>getFillable()
public
getFillable() : array<int, string>
Return values
array<int, string>getFullName()
First and last name, joined - the name Telegram shows.
public
getFullName() : string
Return values
stringgetHandle()
`@username` when they have one, their display name otherwise.
public
getHandle() : string
Return values
stringgetProfilePhotos()
This user's profile photos.
public
getProfilePhotos([?int $offset = null ][, ?int $limit = null ]) : PromiseInterface<string|int, UserProfilePhotos>
Parameters
- $offset : ?int = null
- $limit : ?int = null
Return values
PromiseInterface<string|int, UserProfilePhotos>getRawAttributes()
public
getRawAttributes() : array<string, mixed>
Return values
array<string, mixed>getTelegram()
public
getTelegram() : Telegram
Return values
TelegramjsonSerialize()
The payload this part would be sent back to Telegram as - nested parts and collections flattened, timestamps left as the integers they arrived as.
public
jsonSerialize() : array<string, mixed>
Return values
array<string, mixed>mention()
A Markdown or HTML mention that links to this user, which works even when they have no username.
public
mention([string $parseMode = 'HTML' ]) : string
Parameters
- $parseMode : string = 'HTML'
Return values
stringoffsetExists()
public
offsetExists(mixed $offset) : bool
Parameters
- $offset : mixed
Return values
booloffsetGet()
public
offsetGet(mixed $offset) : mixed
Parameters
- $offset : mixed
offsetSet()
public
offsetSet(mixed $offset, mixed $value) : void
Parameters
- $offset : mixed
- $value : mixed
offsetUnset()
public
offsetUnset(mixed $offset) : void
Parameters
- $offset : mixed
resolveSubtype()
The concrete class an incoming payload belongs to, for a union parent.
public
static resolveSubtype(array<string, mixed> $attributes) : Part>
Tagged unions resolve on their discriminator. The handful Telegram leaves
untagged (InputMessageContent, and the rest), and any payload whose tag
this build does not recognise - a member added to the Bot API since it was
generated - resolve instead to the subtype whose attributes the payload
matches most closely.
Parameters
- $attributes : array<string, mixed>
Tags
Return values
Part>sendMessage()
Messages this user directly.
public
sendMessage(string $text[, array<string, mixed> $options = [] ]) : PromiseInterface<string|int, Message>
Parameters
- $text : string
- $options : array<string, mixed> = []
-
Any other
sendMessagefield.
Return values
PromiseInterface<string|int, Message>setAttribute()
public
setAttribute(string $key, mixed $value) : void
Parameters
- $key : string
- $value : mixed
factory()
Builds another part from the same client - for nested objects.
protected
factory() : Factory
Return values
FactorygetRawAttribute()
Reads straight from the attribute bag, skipping the `get{Key}Attribute` hook.
protected
getRawAttribute(string $key) : mixed
Parameters
- $key : string
setRawAttribute()
Writes straight to the attribute bag, skipping the `set{Key}Attribute` hook and any cast. For use *inside* a mutator, which would otherwise have no way to store its shaped value without recursing through {@see setAttribute()}.
protected
setRawAttribute(string $key, mixed $value) : void
Parameters
- $key : string
- $value : mixed