TelegramPHP Documentation

Update extends Part
in package

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 an incoming update. At most one of the optional fields can be present in any given update.

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

v10.3

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

$business_connection  : BusinessConnection|null
$business_message  : Message|null
$callback_query  : CallbackQuery|null
$channel_post  : Message|null
$chat_boost  : ChatBoostUpdated|null
$chat_join_request  : ChatJoinRequest|null
$chat_member  : ChatMemberUpdated|null
$chosen_inline_result  : ChosenInlineResult|null
$deleted_business_messages  : BusinessMessagesDeleted|null
$edited_business_message  : Message|null
$edited_channel_post  : Message|null
$edited_message  : Message|null
$guest_message  : Message|null
$inline_query  : InlineQuery|null
$managed_bot  : ManagedBotUpdated|null
$message  : Message|null
$message_reaction  : MessageReactionUpdated|null
$message_reaction_count  : MessageReactionCountUpdated|null
$my_chat_member  : ChatMemberUpdated|null
$poll  : Poll|null
$poll_answer  : PollAnswer|null
$pre_checkout_query  : PreCheckoutQuery|null
$purchased_paid_media  : PaidMediaPurchased|null
$removed_chat_boost  : ChatBoostRemoved|null
$shipping_query  : ShippingQuery|null
$stopped_message_generation  : MessageGenerationStopped|null
$subscription  : BotSubscriptionUpdated|null
$update_id  : int
$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>
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.
offsetExists()  : bool
offsetGet()  : mixed
offsetSet()  : void
offsetUnset()  : void
resolveSubtype()  : Part>
The concrete class an incoming payload belongs to, for a union parent.
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

$business_connection

public BusinessConnection|null $business_connection

Optional. The bot was connected to or disconnected from a business account, or a user edited an existing connection with the bot

$business_message

public Message|null $business_message

Optional. New message from a connected business account

$channel_post

public Message|null $channel_post

Optional. New incoming channel post of any kind - text, photo, sticker, etc.

$chat_boost

public ChatBoostUpdated|null $chat_boost

Optional. A chat boost was added or changed. The bot must be an administrator in the chat to receive these updates.

$chat_join_request

public ChatJoinRequest|null $chat_join_request

Optional. A request to join the chat has been sent. The bot must have the can_invite_users administrator right in the chat to receive these updates.

$chat_member

public ChatMemberUpdated|null $chat_member

Optional. A chat member's status was updated in a chat. The bot must be an administrator in the chat and must explicitly specify "chat_member" in the list of allowed_updates to receive these updates.

$chosen_inline_result

public ChosenInlineResult|null $chosen_inline_result

Optional. The result of an inline query that was chosen by a user and sent to their chat partner. Please see our documentation on the feedback collecting for details on how to enable these updates for your bot.

$deleted_business_messages

public BusinessMessagesDeleted|null $deleted_business_messages

Optional. Messages were deleted from a connected business account

$edited_business_message

public Message|null $edited_business_message

Optional. New version of a message from a connected business account

$edited_channel_post

public Message|null $edited_channel_post

Optional. New version of a channel post that is known to the bot and was edited. This update may at times be triggered by changes to message fields that are either unavailable or not actively used by your bot.

$edited_message

public Message|null $edited_message

Optional. New version of a message that is known to the bot and was edited. This update may at times be triggered by changes to message fields that are either unavailable or not actively used by your bot.

$guest_message

public Message|null $guest_message

Optional. New guest message. The bot can use the field Message.guest_query_id and the method answerGuestQuery to send a message in response.

$managed_bot

public ManagedBotUpdated|null $managed_bot

Optional. A new bot was created to be managed by the bot, or token or owner of a managed bot was changed

$message

public Message|null $message

Optional. New incoming message of any kind - text, photo, sticker, etc.

$message_reaction

public MessageReactionUpdated|null $message_reaction

Optional. A reaction to a message was changed by a user. The bot must be an administrator in the chat and must explicitly specify "message_reaction" in the list of allowed_updates to receive these updates. The update isn't received for reactions set by bots.

$message_reaction_count

public MessageReactionCountUpdated|null $message_reaction_count

Optional. Reactions to a message with anonymous reactions were changed. The bot must be an administrator in the chat and must explicitly specify "message_reaction_count" in the list of allowed_updates to receive these updates. The updates are grouped and can be sent with delay up to a few minutes.

$my_chat_member

public ChatMemberUpdated|null $my_chat_member

Optional. The bot's chat member status was updated in a chat. For private chats, this update is received only when the bot is blocked or unblocked by the user.

$poll

public Poll|null $poll

Optional. New poll state. Bots receive only updates about manually stopped polls and polls, which are sent by the bot.

$poll_answer

public PollAnswer|null $poll_answer

Optional. A user changed their answer in a non-anonymous poll. Bots receive new votes only in polls that were sent by the bot itself.

$pre_checkout_query

public PreCheckoutQuery|null $pre_checkout_query

Optional. New incoming pre-checkout query. Contains full information about checkout.

$purchased_paid_media

public PaidMediaPurchased|null $purchased_paid_media

Optional. A user purchased paid media with a non-empty payload sent by the bot in a non-channel chat

$removed_chat_boost

public ChatBoostRemoved|null $removed_chat_boost

Optional. A boost was removed from a chat. The bot must be an administrator in the chat to receive these updates.

$shipping_query

public ShippingQuery|null $shipping_query

Optional. New incoming shipping query. Only for invoices with flexible price.

$stopped_message_generation

public MessageGenerationStopped|null $stopped_message_generation

Optional. A user asked the bot to stop the generation of a message

$update_id

public int $update_id

The update's unique identifier. Update identifiers start from a certain positive number and increase sequentially. This identifier becomes especially handy if you're using webhooks, since it allows you to ignore repeated updates or to restore the correct update sequence, should they get out of order. If there are no new updates for at least a week, then identifier of the next update will be chosen randomly instead of sequentially.

$casts

Attribute name => Telegram type token ("User", "Array of PhotoSize"), used to hydrate nested objects into parts.

protected array<string, string> $casts = ['message' => 'Message', 'edited_message' => 'Message', 'channel_post' => 'Message', 'edited_channel_post' => 'Message', 'business_connection' => 'BusinessConnection', 'business_message' => 'Message', 'edited_business_message' => 'Message', 'deleted_business_messages' => 'BusinessMessagesDeleted', 'guest_message' => 'Message', 'message_reaction' => 'MessageReactionUpdated', 'message_reaction_count' => 'MessageReactionCountUpdated', 'inline_query' => 'InlineQuery', 'chosen_inline_result' => 'ChosenInlineResult', 'callback_query' => 'CallbackQuery', 'shipping_query' => 'ShippingQuery', 'pre_checkout_query' => 'PreCheckoutQuery', 'purchased_paid_media' => 'PaidMediaPurchased', 'poll' => 'Poll', 'poll_answer' => 'PollAnswer', 'my_chat_member' => 'ChatMemberUpdated', 'chat_member' => 'ChatMemberUpdated', 'chat_join_request' => 'ChatJoinRequest', 'chat_boost' => 'ChatBoostUpdated', 'removed_chat_boost' => 'ChatBoostRemoved', 'managed_bot' => 'ManagedBotUpdated', 'subscription' => 'BotSubscriptionUpdated', 'stopped_message_generation' => 'MessageGenerationStopped']

$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 = ['update_id', 'message', 'edited_message', 'channel_post', 'edited_channel_post', 'business_connection', 'business_message', 'edited_business_message', 'deleted_business_messages', 'guest_message', 'message_reaction', 'message_reaction_count', 'inline_query', 'chosen_inline_result', 'callback_query', 'shipping_query', 'pre_checkout_query', 'purchased_paid_media', 'poll', 'poll_answer', 'my_chat_member', 'chat_member', 'chat_join_request', 'chat_boost', 'removed_chat_boost', 'managed_bot', 'subscription', 'stopped_message_generation']

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
string

attributeExists()

public attributeExists(string $key) : bool
Parameters
$key : string
Return values
bool

fill()

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>

getRawAttributes()

public getRawAttributes() : array<string, mixed>
Return values
array<string, mixed>

jsonSerialize()

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>

offsetExists()

public offsetExists(mixed $offset) : bool
Parameters
$offset : mixed
Return values
bool

offsetGet()

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
throws
PartException

When the part is not a union, or nothing matches.

Return values
Part>

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
Factory

getRawAttribute()

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
On this page

Search results