TelegramPHP Documentation

Message extends MaybeInaccessibleMessage
in package
uses MessageBehaviour

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 message.

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

v10.3

Table of Contents

Constants

DISCRIMINATOR  : mixed = null
The attribute whose value names the concrete subtype.
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

$animation  : Animation|null
$audio  : Audio|null
$author_signature  : string|null
$boost_added  : ChatBoostAdded|null
$business_connection_id  : string|null
$caption  : string|null
$caption_entities  : Collection<string|int, MessageEntity>|null
$channel_chat_created  : bool|null
$chat  : Chat
$chat_background_set  : ChatBackground|null
$chat_owner_changed  : ChatOwnerChanged|null
$chat_owner_left  : ChatOwnerLeft|null
$chat_shared  : ChatShared|null
$checklist  : Checklist|null
$checklist_tasks_added  : ChecklistTasksAdded|null
$checklist_tasks_done  : ChecklistTasksDone|null
$community_chat_added  : CommunityChatAdded|null
$community_chat_joined  : CommunityChatJoined|null
$community_chat_removed  : CommunityChatRemoved|null
$connected_website  : string|null
$contact  : Contact|null
$date  : CarbonImmutable
$delete_chat_photo  : bool|null
$dice  : Dice|null
$direct_message_price_changed  : DirectMessagePriceChanged|null
$direct_messages_topic  : DirectMessagesTopic|null
$document  : Document|null
$edit_date  : CarbonImmutable|null
$effect_id  : string|null
$entities  : Collection<string|int, MessageEntity>|null
$ephemeral_message_id  : int|null
$external_reply  : ExternalReplyInfo|null
$forum_topic_closed  : ForumTopicClosed|null
$forum_topic_created  : ForumTopicCreated|null
$forum_topic_edited  : ForumTopicEdited|null
$forum_topic_reopened  : ForumTopicReopened|null
$forward_origin  : MessageOrigin|null
$from  : User|null
$game  : Game|null
$general_forum_topic_hidden  : GeneralForumTopicHidden|null
$general_forum_topic_unhidden  : GeneralForumTopicUnhidden|null
$gift  : GiftInfo|null
$gift_upgrade_sent  : GiftInfo|null
$giveaway  : Giveaway|null
$giveaway_completed  : GiveawayCompleted|null
$giveaway_created  : GiveawayCreated|null
$giveaway_winners  : GiveawayWinners|null
$group_chat_created  : bool|null
$guest_bot_caller_chat  : Chat|null
$guest_bot_caller_user  : User|null
$guest_query_id  : string|null
$has_media_spoiler  : bool|null
$has_protected_content  : bool|null
$invoice  : Invoice|null
$is_automatic_forward  : bool|null
$is_from_offline  : bool|null
$is_paid_post  : bool|null
$is_topic_message  : bool|null
$left_chat_member  : User|null
$link_preview_options  : LinkPreviewOptions|null
$live_photo  : LivePhoto|null
$location  : Location|null
$managed_bot_created  : ManagedBotCreated|null
$media_group_id  : string|null
$message_auto_delete_timer_changed  : MessageAutoDeleteTimerChanged|null
$message_id  : int
$message_thread_id  : int|null
$migrate_from_chat_id  : int|null
$migrate_to_chat_id  : int|null
$new_chat_members  : Collection<string|int, User>|null
$new_chat_photo  : Collection<string|int, PhotoSize>|null
$new_chat_title  : string|null
$paid_media  : PaidMediaInfo|null
$paid_message_price_changed  : PaidMessagePriceChanged|null
$paid_star_count  : int|null
$passport_data  : PassportData|null
$photo  : Collection<string|int, PhotoSize>|null
$pinned_message  : MaybeInaccessibleMessage|null
$poll  : Poll|null
$poll_option_added  : PollOptionAdded|null
$poll_option_deleted  : PollOptionDeleted|null
$proximity_alert_triggered  : ProximityAlertTriggered|null
$quote  : TextQuote|null
$receiver_user  : User|null
$refunded_payment  : RefundedPayment|null
$reply_markup  : InlineKeyboardMarkup|null
$reply_to_checklist_task_id  : int|null
$reply_to_message  : Message|null
$reply_to_poll_option_id  : string|null
$reply_to_story  : Story|null
$rich_message  : RichMessage|null
$sender_boost_count  : int|null
$sender_business_bot  : User|null
$sender_chat  : Chat|null
$sender_tag  : string|null
$show_caption_above_media  : bool|null
$sticker  : Sticker|null
$story  : Story|null
$successful_payment  : SuccessfulPayment|null
$suggested_post_approval_failed  : SuggestedPostApprovalFailed|null
$suggested_post_approved  : SuggestedPostApproved|null
$suggested_post_declined  : SuggestedPostDeclined|null
$suggested_post_info  : SuggestedPostInfo|null
$suggested_post_paid  : SuggestedPostPaid|null
$suggested_post_refunded  : SuggestedPostRefunded|null
$supergroup_chat_created  : bool|null
$text  : string|null
$unique_gift  : UniqueGiftInfo|null
$users_shared  : UsersShared|null
$venue  : Venue|null
$via_bot  : User|null
$video  : Video|null
$video_chat_ended  : VideoChatEnded|null
$video_chat_participants_invited  : VideoChatParticipantsInvited|null
$video_chat_scheduled  : VideoChatScheduled|null
$video_chat_started  : VideoChatStarted|null
$video_note  : VideoNote|null
$voice  : Voice|null
$web_app_data  : WebAppData|null
$write_access_allowed  : WriteAccessAllowed|null
$casts  : array<string, string>
$dates  : array<int, string>
$fillable  : array<int, string>
$telegram  : Telegram

Methods

__construct()  : mixed
__debugInfo()  : array<string, mixed>
__get()  : mixed
__isset()  : bool
__set()  : void
__toString()  : string
attributeExists()  : bool
copy()  : PromiseInterface<string|int, MessageId>
Copies this message to another chat, without a link back to the original.
delete()  : PromiseInterface<string|int, bool>
Deletes this message.
edit()  : PromiseInterface<string|int, Message|bool>
Edits this message's text. Only messages the bot sent can be edited.
editCaption()  : PromiseInterface<string|int, Message|bool>
Edits this message's caption.
editReplyMarkup()  : PromiseInterface<string|int, Message|bool>
Replaces the buttons under this message.
fill()  : void
forward()  : PromiseInterface<string|int, Message>
Forwards this message to another chat.
getAttribute()  : mixed
getCasts()  : array<string, string>
getChatId()  : int|string|null
The id of the chat this message belongs to.
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
pin()  : PromiseInterface<string|int, bool>
Pins this message in its chat.
react()  : PromiseInterface<string|int, bool>
Reacts to this message. Passing no emoji clears the bot's reaction.
reply()  : PromiseInterface<string|int, Message>
Replies to this message.
replyWithDocument()  : PromiseInterface<string|int, Message>
Replies with a document.
replyWithPhoto()  : PromiseInterface<string|int, Message>
Replies with a photo.
resolveSubtype()  : Part>
say()  : PromiseInterface<string|int, Message>
Sends a message to this chat without quoting this one.
setAttribute()  : void
unpin()  : PromiseInterface<string|int, bool>
Unpins this message.
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.

public mixed DISCRIMINATOR = null

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

$animation

public Animation|null $animation

Optional. Message is an animation, information about the animation. For backward compatibility, when this field is set, the document field will also be set.

$audio

public Audio|null $audio

Optional. Message is an audio file, information about the file

$author_signature

public string|null $author_signature

Optional. Signature of the post author for messages in channels, or the custom title of an anonymous group administrator

$business_connection_id

public string|null $business_connection_id

Optional. Unique identifier of the business connection from which the message was received. If non-empty, the message belongs to a chat of the corresponding business account that is independent from any potential bot chat which might share the same identifier.

$caption

public string|null $caption

Optional. Caption for the animation, audio, document, paid media, photo, video or voice

$caption_entities

public Collection<string|int, MessageEntity>|null $caption_entities

Optional. For messages with a caption, special entities like usernames, URLs, bot commands, etc. that appear in the caption

$channel_chat_created

public bool|null $channel_chat_created

Optional. Service message: the channel has been created. This field can't be received in a message coming through updates, because bot can't be a member of a channel when it is created. It can only be found in reply_to_message if someone replies to a very first message in a channel.

$chat_background_set

public ChatBackground|null $chat_background_set

Optional. Service message: chat background set

$chat_owner_changed

public ChatOwnerChanged|null $chat_owner_changed

Optional. Service message: chat owner has changed

$chat_owner_left

public ChatOwnerLeft|null $chat_owner_left

Optional. Service message: chat owner has left

$chat_shared

public ChatShared|null $chat_shared

Optional. Service message: a chat was shared with the bot

$checklist_tasks_added

public ChecklistTasksAdded|null $checklist_tasks_added

Optional. Service message: tasks were added to a checklist

$checklist_tasks_done

public ChecklistTasksDone|null $checklist_tasks_done

Optional. Service message: some tasks in a checklist were marked as done or not done

$community_chat_added

public CommunityChatAdded|null $community_chat_added

Optional. Service message: chat or bot added to a Community

$community_chat_joined

public CommunityChatJoined|null $community_chat_joined

Optional. Service message: chat was joined by a user from a Community

$community_chat_removed

public CommunityChatRemoved|null $community_chat_removed

Optional. Service message: chat or bot removed from a Community

$connected_website

public string|null $connected_website

Optional. The domain name of the website on which the user has logged in. More about Telegram Login: https://core.telegram.org/widgets/login

$contact

public Contact|null $contact

Optional. Message is a shared contact, information about the contact

$date

public CarbonImmutable $date

Date the message was sent in Unix time. It is always a positive number, representing a valid date.

$delete_chat_photo

public bool|null $delete_chat_photo

Optional. Service message: the chat photo was deleted

$dice

public Dice|null $dice

Optional. Message is a dice with random value

$direct_message_price_changed

public DirectMessagePriceChanged|null $direct_message_price_changed

Optional. Service message: the price for paid messages in the corresponding direct messages chat of a channel has changed

$direct_messages_topic

public DirectMessagesTopic|null $direct_messages_topic

Optional. Information about the direct messages chat topic that contains the message

$document

public Document|null $document

Optional. Message is a general file, information about the file

$edit_date

public CarbonImmutable|null $edit_date

Optional. Date the message was last edited in Unix time

$effect_id

public string|null $effect_id

Optional. Unique identifier of the message effect added to the message

$entities

public Collection<string|int, MessageEntity>|null $entities

Optional. For text messages, special entities like usernames, URLs, bot commands, etc. that appear in the text

$ephemeral_message_id

public int|null $ephemeral_message_id

Optional. For ephemeral messages, identifier of the ephemeral message inside this chat. The identifier may be reused for another ephemeral message after the message is deleted or expires.

$external_reply

public ExternalReplyInfo|null $external_reply

Optional. Information about the message that is being replied to, which may come from another chat or forum topic

$forward_origin

public MessageOrigin|null $forward_origin

Optional. Information about the original message for forwarded messages

$from

public User|null $from

Optional. Sender of the message; may be empty for messages sent to channels. For backward compatibility, if the message was sent on behalf of a chat, the field contains a fake sender user in non-channel chats.

$game

public Game|null $game

Optional. Message is a game, information about the game. More about games: https://core.telegram.org/bots/api#games

$gift

public GiftInfo|null $gift

Optional. Service message: a regular gift was sent or received

$gift_upgrade_sent

public GiftInfo|null $gift_upgrade_sent

Optional. Service message: upgrade of a gift was purchased after the gift was sent

$giveaway

public Giveaway|null $giveaway

Optional. The message is a scheduled giveaway message

$giveaway_completed

public GiveawayCompleted|null $giveaway_completed

Optional. Service message: a giveaway without public winners was completed

$giveaway_created

public GiveawayCreated|null $giveaway_created

Optional. Service message: a scheduled giveaway was created

$giveaway_winners

public GiveawayWinners|null $giveaway_winners

Optional. A giveaway with public winners was completed

$group_chat_created

public bool|null $group_chat_created

Optional. Service message: the group has been created

$guest_bot_caller_chat

public Chat|null $guest_bot_caller_chat

Optional. For a message sent by a guest bot, this is the chat whose original message triggered the bot's response

$guest_bot_caller_user

public User|null $guest_bot_caller_user

Optional. For a message sent by a guest bot, this is the user whose original message triggered the bot's response

$guest_query_id

public string|null $guest_query_id

Optional. The unique identifier for the guest query. Use this identifier with the method answerGuestQuery to send a response message. If non-empty, the message belongs to the chat where the guest bot was summoned, which may not coincide with other existing bot chats sharing the same identifier.

$has_media_spoiler

public bool|null $has_media_spoiler

Optional. True, if the message media is covered by a spoiler animation

$has_protected_content

public bool|null $has_protected_content

Optional. True, if the message can't be forwarded

$invoice

public Invoice|null $invoice

Optional. Message is an invoice for a payment, information about the invoice. More about payments: https://core.telegram.org/bots/api#payments

$is_automatic_forward

public bool|null $is_automatic_forward

Optional. True, if the message is a channel post that was automatically forwarded to the connected discussion group

$is_from_offline

public bool|null $is_from_offline

Optional. True, if the message was sent by an implicit action, for example, as an away or a greeting business message, or as a scheduled message

$is_paid_post

public bool|null $is_paid_post

Optional. True, if the message is a paid post. Note that such posts must not be deleted for 24 hours to receive the payment and can't be edited.

$is_topic_message

public bool|null $is_topic_message

Optional. True, if the message is sent to a topic in a forum supergroup or a private chat with the bot

$left_chat_member

public User|null $left_chat_member

Optional. A member was removed from the group, information about them (this member may be the bot itself)

public LinkPreviewOptions|null $link_preview_options

Optional. Options used for link preview generation for the message, if it is a text message and link preview options were changed

$live_photo

public LivePhoto|null $live_photo

Optional. Message is a live photo, information about the live photo. For backward compatibility, when this field is set, the photo field will also be set.

$location

public Location|null $location

Optional. Message is a shared location, information about the location

$managed_bot_created

public ManagedBotCreated|null $managed_bot_created

Optional. Service message: user created a bot that will be managed by the current bot

$media_group_id

public string|null $media_group_id

Optional. The unique identifier inside this chat of a media message group this message belongs to

$message_auto_delete_timer_changed

public MessageAutoDeleteTimerChanged|null $message_auto_delete_timer_changed

Optional. Service message: auto-delete timer settings changed in the chat

$message_id

public int $message_id

Unique message identifier inside this chat; 0 for ephemeral messages. In specific instances (e.g., a message containing a video sent to a big chat), the server might automatically schedule a message instead of sending it immediately. In such cases, this field will be 0 and the relevant message will be unusable until it is actually sent.

$message_thread_id

public int|null $message_thread_id

Optional. Unique identifier of a message thread or forum topic to which the message belongs; for supergroups and private chats only

$migrate_from_chat_id

public int|null $migrate_from_chat_id

Optional. The supergroup has been migrated from a group with the specified identifier. 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 signed 64-bit integer or double-precision float type are safe for storing this identifier.

$migrate_to_chat_id

public int|null $migrate_to_chat_id

Optional. The group has been migrated to a supergroup with the specified identifier. 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 signed 64-bit integer or double-precision float type are safe for storing this identifier.

$new_chat_members

public Collection<string|int, User>|null $new_chat_members

Optional. New members that were added to the group or supergroup and information about them (the bot itself may be one of these members)

$new_chat_photo

public Collection<string|int, PhotoSize>|null $new_chat_photo

Optional. A chat photo was change to this value

$new_chat_title

public string|null $new_chat_title

Optional. A chat title was changed to this value

$paid_media

public PaidMediaInfo|null $paid_media

Optional. Message contains paid media; information about the paid media

$paid_message_price_changed

public PaidMessagePriceChanged|null $paid_message_price_changed

Optional. Service message: the price for paid messages has changed in the chat

$paid_star_count

public int|null $paid_star_count

Optional. The number of Telegram Stars that were paid by the sender of the message to send it

$photo

public Collection<string|int, PhotoSize>|null $photo

Optional. Message is a photo, available sizes of the photo

$pinned_message

public MaybeInaccessibleMessage|null $pinned_message

Optional. Specified message was pinned. Note that the Message object in this field will not contain further reply_to_message fields even if it itself is a reply.

$poll

public Poll|null $poll

Optional. Message is a native poll, information about the poll

$poll_option_added

public PollOptionAdded|null $poll_option_added

Optional. Service message: answer option was added to a poll

$poll_option_deleted

public PollOptionDeleted|null $poll_option_deleted

Optional. Service message: answer option was deleted from a poll

$proximity_alert_triggered

public ProximityAlertTriggered|null $proximity_alert_triggered

Optional. Service message: a user in the chat triggered another user's proximity alert while sharing Live Location

$quote

public TextQuote|null $quote

Optional. For replies that quote part of the original message, the quoted part of the message

$receiver_user

public User|null $receiver_user

Optional. For ephemeral messages, the user who received the message

$refunded_payment

public RefundedPayment|null $refunded_payment

Optional. Message is a service message about a refunded payment, information about the payment. More about payments: https://core.telegram.org/bots/api#payments

$reply_markup

public InlineKeyboardMarkup|null $reply_markup

Optional. Inline keyboard attached to the message. login_url buttons are represented as ordinary url buttons.

$reply_to_checklist_task_id

public int|null $reply_to_checklist_task_id

Optional. Identifier of the specific checklist task that is being replied to

$reply_to_message

public Message|null $reply_to_message

Optional. For replies in the same chat and message thread, the original message. Note that the Message object in this field will not contain further reply_to_message fields even if it itself is a reply. If the message is a reply to an ephemeral message, then this field may be omitted.

$reply_to_poll_option_id

public string|null $reply_to_poll_option_id

Optional. Persistent identifier of the specific poll option that is being replied to

$reply_to_story

public Story|null $reply_to_story

Optional. For replies to a story, the original story

$rich_message

public RichMessage|null $rich_message

Optional. Message is a rich formatted message

$sender_boost_count

public int|null $sender_boost_count

Optional. If the sender of the message boosted the chat, the number of boosts added by the user

$sender_business_bot

public User|null $sender_business_bot

Optional. The bot that actually sent the message on behalf of the business account. Available only for outgoing messages sent on behalf of the connected business account.

$sender_chat

public Chat|null $sender_chat

Optional. Sender of the message when sent on behalf of a chat. For example, the supergroup itself for messages sent by its anonymous administrators or a linked channel for messages automatically forwarded to the channel's discussion group. For backward compatibility, if the message was sent on behalf of a chat, the field from contains a fake sender user in non-channel chats.

$sender_tag

public string|null $sender_tag

Optional. Tag or custom title of the sender of the message; for supergroups only

$show_caption_above_media

public bool|null $show_caption_above_media

Optional. True, if the caption must be shown above the message media

$sticker

public Sticker|null $sticker

Optional. Message is a sticker, information about the sticker

$story

public Story|null $story

Optional. Message is a forwarded story

$successful_payment

public SuccessfulPayment|null $successful_payment

Optional. Message is a service message about a successful payment, information about the payment. More about payments: https://core.telegram.org/bots/api#payments

$suggested_post_info

public SuggestedPostInfo|null $suggested_post_info

Optional. Information about suggested post parameters if the message is a suggested post in a channel direct messages chat. If the message is an approved or declined suggested post, then it can't be edited.

$suggested_post_paid

public SuggestedPostPaid|null $suggested_post_paid

Optional. Service message: payment for a suggested post was received

$suggested_post_refunded

public SuggestedPostRefunded|null $suggested_post_refunded

Optional. Service message: payment for a suggested post was refunded

$supergroup_chat_created

public bool|null $supergroup_chat_created

Optional. Service message: the supergroup has been created. This field can't be received in a message coming through updates, because bot can't be a member of a supergroup when it is created. It can only be found in reply_to_message if someone replies to a very first message in a directly created supergroup.

$text

public string|null $text

Optional. For text messages, the actual UTF-8 text of the message

$unique_gift

public UniqueGiftInfo|null $unique_gift

Optional. Service message: a unique gift was sent or received

$users_shared

public UsersShared|null $users_shared

Optional. Service message: users were shared with the bot

$venue

public Venue|null $venue

Optional. Message is a venue, information about the venue. For backward compatibility, when this field is set, the location field will also be set.

$via_bot

public User|null $via_bot

Optional. Bot through which the message was sent

$video

public Video|null $video

Optional. Message is a video, information about the video

$video_note

public VideoNote|null $video_note

Optional. Message is a video note, information about the video message

$voice

public Voice|null $voice

Optional. Message is a voice message, information about the file

$web_app_data

public WebAppData|null $web_app_data

Optional. Service message: data sent by a Web App

$write_access_allowed

public WriteAccessAllowed|null $write_access_allowed

Optional. Service message: the user allowed the bot to write messages after adding it to the attachment or side menu, launching a Web App from a link, or accepting an explicit request from a Web App sent by the method requestWriteAccess

$casts

protected array<string, string> $casts = ['direct_messages_topic' => 'DirectMessagesTopic', 'from' => 'User', 'sender_chat' => 'Chat', 'sender_business_bot' => 'User', 'receiver_user' => 'User', 'chat' => 'Chat', 'forward_origin' => 'MessageOrigin', 'reply_to_message' => 'Message', 'external_reply' => 'ExternalReplyInfo', 'quote' => 'TextQuote', 'reply_to_story' => 'Story', 'via_bot' => 'User', 'guest_bot_caller_user' => 'User', 'guest_bot_caller_chat' => 'Chat', 'entities' => 'Array of MessageEntity', 'link_preview_options' => 'LinkPreviewOptions', 'suggested_post_info' => 'SuggestedPostInfo', 'rich_message' => 'RichMessage', 'animation' => 'Animation', 'audio' => 'Audio', 'document' => 'Document', 'live_photo' => 'LivePhoto', 'paid_media' => 'PaidMediaInfo', 'photo' => 'Array of PhotoSize', 'sticker' => 'Sticker', 'story' => 'Story', 'video' => 'Video', 'video_note' => 'VideoNote', 'voice' => 'Voice', 'caption_entities' => 'Array of MessageEntity', 'checklist' => 'Checklist', 'contact' => 'Contact', 'dice' => 'Dice', 'game' => 'Game', 'poll' => 'Poll', 'venue' => 'Venue', 'location' => 'Location', 'new_chat_members' => 'Array of User', 'left_chat_member' => 'User', 'chat_owner_left' => 'ChatOwnerLeft', 'chat_owner_changed' => 'ChatOwnerChanged', 'new_chat_photo' => 'Array of PhotoSize', 'message_auto_delete_timer_changed' => 'MessageAutoDeleteTimerChanged', 'pinned_message' => 'MaybeInaccessibleMessage', 'invoice' => 'Invoice', 'successful_payment' => 'SuccessfulPayment', 'refunded_payment' => 'RefundedPayment', 'users_shared' => 'UsersShared', 'chat_shared' => 'ChatShared', 'gift' => 'GiftInfo', 'unique_gift' => 'UniqueGiftInfo', 'gift_upgrade_sent' => 'GiftInfo', 'write_access_allowed' => 'WriteAccessAllowed', 'passport_data' => 'PassportData', 'proximity_alert_triggered' => 'ProximityAlertTriggered', 'boost_added' => 'ChatBoostAdded', 'chat_background_set' => 'ChatBackground', 'checklist_tasks_done' => 'ChecklistTasksDone', 'checklist_tasks_added' => 'ChecklistTasksAdded', 'community_chat_added' => 'CommunityChatAdded', 'community_chat_joined' => 'CommunityChatJoined', 'community_chat_removed' => 'CommunityChatRemoved', 'direct_message_price_changed' => 'DirectMessagePriceChanged', 'forum_topic_created' => 'ForumTopicCreated', 'forum_topic_edited' => 'ForumTopicEdited', 'forum_topic_closed' => 'ForumTopicClosed', 'forum_topic_reopened' => 'ForumTopicReopened', 'general_forum_topic_hidden' => 'GeneralForumTopicHidden', 'general_forum_topic_unhidden' => 'GeneralForumTopicUnhidden', 'giveaway_created' => 'GiveawayCreated', 'giveaway' => 'Giveaway', 'giveaway_winners' => 'GiveawayWinners', 'giveaway_completed' => 'GiveawayCompleted', 'managed_bot_created' => 'ManagedBotCreated', 'paid_message_price_changed' => 'PaidMessagePriceChanged', 'poll_option_added' => 'PollOptionAdded', 'poll_option_deleted' => 'PollOptionDeleted', 'suggested_post_approved' => 'SuggestedPostApproved', 'suggested_post_approval_failed' => 'SuggestedPostApprovalFailed', 'suggested_post_declined' => 'SuggestedPostDeclined', 'suggested_post_paid' => 'SuggestedPostPaid', 'suggested_post_refunded' => 'SuggestedPostRefunded', 'video_chat_scheduled' => 'VideoChatScheduled', 'video_chat_started' => 'VideoChatStarted', 'video_chat_ended' => 'VideoChatEnded', 'video_chat_participants_invited' => 'VideoChatParticipantsInvited', 'web_app_data' => 'WebAppData', 'reply_markup' => 'InlineKeyboardMarkup']

$dates

protected array<int, string> $dates = ['date', 'edit_date']

$fillable

protected array<int, string> $fillable = ['message_id', 'message_thread_id', 'direct_messages_topic', 'from', 'sender_chat', 'sender_boost_count', 'sender_business_bot', 'sender_tag', 'receiver_user', 'ephemeral_message_id', 'date', 'guest_query_id', 'business_connection_id', 'chat', 'forward_origin', 'is_topic_message', 'is_automatic_forward', 'reply_to_message', 'external_reply', 'quote', 'reply_to_story', 'reply_to_checklist_task_id', 'reply_to_poll_option_id', 'via_bot', 'guest_bot_caller_user', 'guest_bot_caller_chat', 'edit_date', 'has_protected_content', 'is_from_offline', 'is_paid_post', 'media_group_id', 'author_signature', 'paid_star_count', 'text', 'entities', 'link_preview_options', 'suggested_post_info', 'effect_id', 'rich_message', 'animation', 'audio', 'document', 'live_photo', 'paid_media', 'photo', 'sticker', 'story', 'video', 'video_note', 'voice', 'caption', 'caption_entities', 'show_caption_above_media', 'has_media_spoiler', 'checklist', 'contact', 'dice', 'game', 'poll', 'venue', 'location', 'new_chat_members', 'left_chat_member', 'chat_owner_left', 'chat_owner_changed', 'new_chat_title', 'new_chat_photo', 'delete_chat_photo', 'group_chat_created', 'supergroup_chat_created', 'channel_chat_created', 'message_auto_delete_timer_changed', 'migrate_to_chat_id', 'migrate_from_chat_id', 'pinned_message', 'invoice', 'successful_payment', 'refunded_payment', 'users_shared', 'chat_shared', 'gift', 'unique_gift', 'gift_upgrade_sent', 'connected_website', 'write_access_allowed', 'passport_data', 'proximity_alert_triggered', 'boost_added', 'chat_background_set', 'checklist_tasks_done', 'checklist_tasks_added', 'community_chat_added', 'community_chat_joined', 'community_chat_removed', 'direct_message_price_changed', 'forum_topic_created', 'forum_topic_edited', 'forum_topic_closed', 'forum_topic_reopened', 'general_forum_topic_hidden', 'general_forum_topic_unhidden', 'giveaway_created', 'giveaway', 'giveaway_winners', 'giveaway_completed', 'managed_bot_created', 'paid_message_price_changed', 'poll_option_added', 'poll_option_deleted', 'suggested_post_approved', 'suggested_post_approval_failed', 'suggested_post_declined', 'suggested_post_paid', 'suggested_post_refunded', 'video_chat_scheduled', 'video_chat_started', 'video_chat_ended', 'video_chat_participants_invited', 'web_app_data', 'reply_markup']

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

copy()

Copies this message to another chat, without a link back to the original.

public copy(int|string $chatId[, array<string, mixed> $options = [] ]) : PromiseInterface<string|int, MessageId>
Parameters
$chatId : int|string
$options : array<string, mixed> = []

Any other copyMessage field.

Return values
PromiseInterface<string|int, MessageId>

delete()

Deletes this message.

public delete() : PromiseInterface<string|int, bool>
Return values
PromiseInterface<string|int, bool>

edit()

Edits this message's text. Only messages the bot sent can be edited.

public edit(string $text[, array<string, mixed> $options = [] ]) : PromiseInterface<string|int, Message|bool>
Parameters
$text : string
$options : array<string, mixed> = []

Any other editMessageText field.

Return values
PromiseInterface<string|int, Message|bool>

editCaption()

Edits this message's caption.

public editCaption([?string $caption = null ][, array<string, mixed> $options = [] ]) : PromiseInterface<string|int, Message|bool>
Parameters
$caption : ?string = null
$options : array<string, mixed> = []

Any other editMessageCaption field.

Return values
PromiseInterface<string|int, Message|bool>

editReplyMarkup()

Replaces the buttons under this message.

public editReplyMarkup([array<string, mixed>|JsonSerializable|null $replyMarkup = null ]) : PromiseInterface<string|int, Message|bool>
Parameters
$replyMarkup : array<string, mixed>|JsonSerializable|null = null
Return values
PromiseInterface<string|int, Message|bool>

fill()

public fill(array<string, mixed> $attributes) : void
Parameters
$attributes : array<string, mixed>

forward()

Forwards this message to another chat.

public forward(int|string $chatId[, array<string, mixed> $options = [] ]) : PromiseInterface<string|int, Message>
Parameters
$chatId : int|string
$options : array<string, mixed> = []

Any other forwardMessage field.

Return values
PromiseInterface<string|int, Message>

getAttribute()

public getAttribute(string $key) : mixed
Parameters
$key : string

getCasts()

public getCasts() : array<string, string>
Return values
array<string, string>

getChatId()

The id of the chat this message belongs to.

public getChatId() : int|string|null
Return values
int|string|null

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

pin()

Pins this message in its chat.

public pin([bool $disableNotification = false ]) : PromiseInterface<string|int, bool>
Parameters
$disableNotification : bool = false
Return values
PromiseInterface<string|int, bool>

react()

Reacts to this message. Passing no emoji clears the bot's reaction.

public react([array<int, string>|string|null $emoji = null ][, bool $isBig = false ]) : PromiseInterface<string|int, bool>
Parameters
$emoji : array<int, string>|string|null = null

One or more reaction emoji.

$isBig : bool = false
Return values
PromiseInterface<string|int, bool>

reply()

Replies to this message.

public reply(string $text[, array<string, mixed> $options = [] ]) : PromiseInterface<string|int, Message>
Parameters
$text : string
$options : array<string, mixed> = []

Any other sendMessage field.

Return values
PromiseInterface<string|int, Message>

replyWithDocument()

Replies with a document.

public replyWithDocument(InputFile|string $document[, array<string, mixed> $options = [] ]) : PromiseInterface<string|int, Message>
Parameters
$document : InputFile|string
$options : array<string, mixed> = []

Any other sendDocument field.

Return values
PromiseInterface<string|int, Message>

replyWithPhoto()

Replies with a photo.

public replyWithPhoto(InputFile|string $photo[, array<string, mixed> $options = [] ]) : PromiseInterface<string|int, Message>
Parameters
$photo : InputFile|string
$options : array<string, mixed> = []

Any other sendPhoto field.

Return values
PromiseInterface<string|int, Message>

resolveSubtype()

public static resolveSubtype(array<string, mixed> $attributes) : Part>
Parameters
$attributes : array<string, mixed>
Return values
Part>

say()

Sends a message to this chat without quoting this one.

public say(string $text[, array<string, mixed> $options = [] ]) : PromiseInterface<string|int, Message>
Parameters
$text : string
$options : array<string, mixed> = []

Any other sendMessage field.

Return values
PromiseInterface<string|int, Message>

setAttribute()

public setAttribute(string $key, mixed $value) : void
Parameters
$key : string
$value : mixed

unpin()

Unpins this message.

public unpin() : PromiseInterface<string|int, bool>
Return values
PromiseInterface<string|int, bool>

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