phpbotgram

Update extends TelegramObject
in package
uses UpdateShortcuts

FinalYes

This object represents an incoming update.

At most one of the optional fields can be present in any given update.

Source: https://core.telegram.org/bots/api#update

Table of Contents

Properties

$bot  : Bot|null
$businessConnection  : BusinessConnection|null
$businessMessage  : Message|null
$callbackQuery  : CallbackQuery|null
$channelPost  : Message|null
$chatBoost  : ChatBoostUpdated|null
$chatJoinRequest  : ChatJoinRequest|null
$chatMember  : ChatMemberUpdated|null
$chosenInlineResult  : ChosenInlineResult|null
$deletedBusinessMessages  : BusinessMessagesDeleted|null
$editedBusinessMessage  : Message|null
$editedChannelPost  : Message|null
$editedMessage  : Message|null
$guestMessage  : Message|null
$inlineQuery  : InlineQuery|null
$managedBot  : ManagedBotUpdated|null
$message  : Message|null
$messageReaction  : MessageReactionUpdated|null
$messageReactionCount  : MessageReactionCountUpdated|null
$myChatMember  : ChatMemberUpdated|null
$poll  : Poll|null
$pollAnswer  : PollAnswer|null
$preCheckoutQuery  : PreCheckoutQuery|null
$purchasedPaidMedia  : PaidMediaPurchased|null
$removedChatBoost  : ChatBoostRemoved|null
$shippingQuery  : ShippingQuery|null
$updateId  : int

Methods

__construct()  : mixed
as_()  : static
Alias of withBot() for grep-translating aiogram code that uses obj.as_(bot).
eventType()  : string|null
withBot()  : static
Returns a clone of $this with $bot rebound recursively. Walks every public property; nested `BotContextController` instances are rebound via their own `withBot`, arrays (including nested arrays of arbitrary depth — e.g.

Properties

$businessMessage read-only

public Message|null $businessMessage = null

$editedBusinessMessage read-only

public Message|null $editedBusinessMessage = null

$editedChannelPost read-only

public Message|null $editedChannelPost = null

$updateId read-only

public int $updateId

Methods

__construct()

public __construct(int $updateId[, Message|null $message = null ][, Message|null $editedMessage = null ][, Message|null $channelPost = null ][, Message|null $editedChannelPost = null ][, BusinessConnection|null $businessConnection = null ][, Message|null $businessMessage = null ][, Message|null $editedBusinessMessage = null ][, BusinessMessagesDeleted|null $deletedBusinessMessages = null ][, Message|null $guestMessage = null ][, MessageReactionUpdated|null $messageReaction = null ][, MessageReactionCountUpdated|null $messageReactionCount = null ][, InlineQuery|null $inlineQuery = null ][, ChosenInlineResult|null $chosenInlineResult = null ][, CallbackQuery|null $callbackQuery = null ][, ShippingQuery|null $shippingQuery = null ][, PreCheckoutQuery|null $preCheckoutQuery = null ][, PaidMediaPurchased|null $purchasedPaidMedia = null ][, Poll|null $poll = null ][, PollAnswer|null $pollAnswer = null ][, ChatMemberUpdated|null $myChatMember = null ][, ChatMemberUpdated|null $chatMember = null ][, ChatJoinRequest|null $chatJoinRequest = null ][, ChatBoostUpdated|null $chatBoost = null ][, ChatBoostRemoved|null $removedChatBoost = null ][, ManagedBotUpdated|null $managedBot = null ][, Bot|null $bot = null ]) : mixed
Parameters
$updateId : int
$message : Message|null = null
$editedMessage : Message|null = null
$channelPost : Message|null = null
$editedChannelPost : Message|null = null
$businessConnection : BusinessConnection|null = null
$businessMessage : Message|null = null
$editedBusinessMessage : Message|null = null
$deletedBusinessMessages : BusinessMessagesDeleted|null = null
$guestMessage : Message|null = null
$messageReaction : MessageReactionUpdated|null = null
$messageReactionCount : MessageReactionCountUpdated|null = null
$inlineQuery : InlineQuery|null = null
$chosenInlineResult : ChosenInlineResult|null = null
$callbackQuery : CallbackQuery|null = null
$shippingQuery : ShippingQuery|null = null
$preCheckoutQuery : PreCheckoutQuery|null = null
$purchasedPaidMedia : PaidMediaPurchased|null = null
$poll : Poll|null = null
$pollAnswer : PollAnswer|null = null
$myChatMember : ChatMemberUpdated|null = null
$chatMember : ChatMemberUpdated|null = null
$chatJoinRequest : ChatJoinRequest|null = null
$chatBoost : ChatBoostUpdated|null = null
$removedChatBoost : ChatBoostRemoved|null = null
$managedBot : ManagedBotUpdated|null = null
$bot : Bot|null = null

as_()

Alias of withBot() for grep-translating aiogram code that uses obj.as_(bot).

public as_(Bot|null $bot) : static

IMPORTANT: behaves DIFFERENTLY from upstream — upstream mutates self.bot in place and returns self. The PHP port can't mutate readonly, so this returns a clone. Callers must reassign: $msg = $msg->as($bot).

Parameters
$bot : Bot|null
Return values
static

eventType()

public eventType() : string|null
Return values
string|null

withBot()

Returns a clone of $this with $bot rebound recursively. Walks every public property; nested `BotContextController` instances are rebound via their own `withBot`, arrays (including nested arrays of arbitrary depth — e.g.

public withBot(Bot|null $bot) : static

list<list<KeyboardButton>>) are walked element-wise. Plain values (scalars, DateTime, enums, InputFile etc.) pass through untouched.

Mirrors upstream pydantic model_validate(context={"bot": bot}) (aiogram ContextController.as_/model_dump_json+model_validate).

Scope note: PHP 8.5 treats public readonly as effectively public protected(set) readonly for clone-with — only code running with a scope in the property's declaring class hierarchy (declaring class plus its ancestors and descendants) can use clone($obj, ['x' => ...]) against it. Because this method lives on BotContextController and every TelegramObject/TelegramMethod subclass extends it, the walker's clone($this, [...]) call legally rewrites subclass-declared readonly slots like Message::$chat. External callers cannot use the same syntax — they must funnel through this method.

Parameters
$bot : Bot|null
Return values
static
On this page

Search results