Documentation

EditedMessage extends Message
in package

Class Message

Table of Contents

__call()  : mixed|null
Return the variable for the called getter or magically set properties dynamically.
__construct()  : mixed
Entity constructor.
__toString()  : string
Perform to string
botAddedInChat()  : bool
Bot added in chat
escapeMarkdown()  : string
Escape markdown special characters
getAnimation()  :
getAudio()  :
getAuthorSignature()  :
getBotUsername()  :
getCaption()  :
getCaptionEntities()  : null|array<string|int, MessageEntity>
Optional. For messages with a caption, special entities like usernames, URLs, bot commands, etc. that appear in the caption
getChannelChatCreated()  :
getChat()  :
getCommand()  : string|null
Get command
getConnectedWebsite()  :
getContact()  :
getDate()  :
getDeleteChatPhoto()  :
getDocument()  :
getEditDate()  :
getEntities()  : null|array<string|int, MessageEntity>
Optional. For text messages, special entities like usernames, URLs, bot commands, etc. that appear in the text
getForwardDate()  :
getForwardFrom()  :
getForwardFromChat()  :
getForwardFromMessageId()  :
getForwardSignature()  :
getFrom()  :
getFullCommand()  : string|null
return the entire command like /echo or /echo@bot1 if specified
getGame()  :
getGroupChatCreated()  :
getInvoice()  :
getLeftChatMember()  :
getLocation()  :
getMediaGroupId()  :
getMessageId()  :
getMigrateFromChatId()  :
getMigrateToChatId()  :
getNewChatMembers()  : null|array<string|int, User>
Optional. A new member(s) was added to the group, information about them (one of this members may be the bot itself)
getNewChatPhoto()  : null|array<string|int, PhotoSize>
Optional. A chat photo was changed to this value
getNewChatTitle()  :
getPassportData()  :
getPhoto()  : null|array<string|int, PhotoSize>
Optional. Message is a photo, available sizes of the photo
getPinnedMessage()  :
getProperty()  : mixed
Get a property from the current Entity
getRawData()  :
getReplyToMessage()  :
getSticker()  :
getSuccessfulPayment()  :
getSupergroupChatCreated()  :
getText()  : string
For text messages, the actual UTF-8 text of the message, 0-4096 characters.
getType()  : string
Detect type based on properties.
getVenue()  :
getVideo()  :
getVideoNote()  :
getVoice()  :
toJson()  : string
Perform to json
tryMention()  : string|null
Try to mention the user
assignMemberVariables()  : mixed
Helper to set member variables
makePrettyObjectArray()  : array<string|int, mixed>
Return an array of nice objects from an array of object arrays
subEntities()  : array<string|int, mixed>
Get the list of the properties that are themselves Entities
validate()  : mixed
Perform any special entity validation

Methods

__call()

Return the variable for the called getter or magically set properties dynamically.

public __call( $method,  $args) : mixed|null
Parameters
$method :
$args :
Return values
mixed|null —

__construct()

Entity constructor.

public __construct(array<string|int, mixed> $data[, string $bot_username = '' ]) : mixed
Parameters
$data : array<string|int, mixed>
$bot_username : string = ''
Tags
todo

Get rid of the $bot_username, it shouldn't be here!

throws
TelegramException
Return values
mixed —

__toString()

Perform to string

public __toString() : string
Return values
string —

escapeMarkdown()

Escape markdown special characters

public escapeMarkdown(string $string) : string
Parameters
$string : string
Return values
string —

getAnimation()

public getAnimation() :

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

Return values
—

getAudio()

public getAudio() :

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

Return values
—

getAuthorSignature()

public getAuthorSignature() :

Optional. Signature of the post author for messages in channels

Return values
—

getBotUsername()

public getBotUsername() :

Return the bot name passed to this entity

Return values
—

getCaption()

public getCaption() :

Optional. Caption for the document, photo or video, 0-200 characters

Return values
—

getCaptionEntities()

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

public getCaptionEntities() : null|array<string|int, MessageEntity>

This method overrides the default getCaptionEntities method and returns a nice array of MessageEntity objects.

Return values
null|array<string|int, MessageEntity> —

getChannelChatCreated()

public getChannelChatCreated() :

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.

Return values
—

getChat()

public getChat() :

Conversation the message belongs to

Return values
—

getCommand()

Get command

public getCommand() : string|null
Return values
string|null —

getConnectedWebsite()

public getConnectedWebsite() :

Optional. The domain name of the website on which the user has logged in.

Return values
—

getContact()

public getContact() :

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

Return values
—

getDate()

public getDate() :

Date the message was sent in Unix time

Return values
—

getDeleteChatPhoto()

public getDeleteChatPhoto() :

Optional. Service message: the chat photo was deleted

Return values
—

getDocument()

public getDocument() :

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

Return values
—

getEditDate()

public getEditDate() :

Optional. Date the message was last edited in Unix time

Return values
—

getEntities()

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

public getEntities() : null|array<string|int, MessageEntity>

This method overrides the default getEntities method and returns a nice array of MessageEntity objects.

Return values
null|array<string|int, MessageEntity> —

getForwardDate()

public getForwardDate() :

Optional. For forwarded messages, date the original message was sent in Unix time

Return values
—

getForwardFrom()

public getForwardFrom() :

Optional. For forwarded messages, sender of the original message

Return values
—

getForwardFromChat()

public getForwardFromChat() :

Optional. For messages forwarded from a channel, information about the original channel

Return values
—

getForwardFromMessageId()

public getForwardFromMessageId() :

Optional. For forwarded channel posts, identifier of the original message in the channel

Return values
—

getForwardSignature()

public getForwardSignature() :

Optional. For messages forwarded from channels, signature of the post author if present

Return values
—

getFrom()

public getFrom() :

Optional. Sender, can be empty for messages sent to channels

Return values
—

getFullCommand()

return the entire command like /echo or /echo@bot1 if specified

public getFullCommand() : string|null
Return values
string|null —

getGame()

public getGame() :

Optional. Message is a game, information about the game.

Return values
—

getGroupChatCreated()

public getGroupChatCreated() :

Optional. Service message: the group has been created

Return values
—

getInvoice()

public getInvoice() :

Optional. Message is an invoice for a payment, information about the invoice.

Return values
—

getLeftChatMember()

public getLeftChatMember() :

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

Return values
—

getLocation()

public getLocation() :

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

Return values
—

getMediaGroupId()

public getMediaGroupId() :

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

Return values
—

getMessageId()

public getMessageId() :

Unique message identifier

Return values
—

getMigrateFromChatId()

public getMigrateFromChatId() :

Optional. The supergroup has been migrated from a group with the specified identifier. This number may be greater than 32 bits and some programming languages may have difficulty/silent defects in interpreting it. But it smaller than 52 bits, so a signed 64 bit integer or double-precision float type are safe for storing this identifier.

Return values
—

getMigrateToChatId()

public getMigrateToChatId() :

Optional. The group has been migrated to a supergroup with the specified identifier. This number may be greater than 32 bits and some programming languages may have difficulty/silent defects in interpreting it. But it smaller than 52 bits, so a signed 64 bit integer or double-precision float type are safe for storing this identifier.

Return values
—

getNewChatMembers()

Optional. A new member(s) was added to the group, information about them (one of this members may be the bot itself)

public getNewChatMembers() : null|array<string|int, User>

This method overrides the default getNewChatMembers method and returns a nice array of User objects.

Return values
null|array<string|int, User> —

getNewChatPhoto()

Optional. A chat photo was changed to this value

public getNewChatPhoto() : null|array<string|int, PhotoSize>

This method overrides the default getNewChatPhoto method and returns a nice array of PhotoSize objects.

Return values
null|array<string|int, PhotoSize> —

getNewChatTitle()

public getNewChatTitle() :

Optional. A chat title was changed to this value

Return values
—

getPassportData()

public getPassportData() :

Optional. Telegram Passport data

Return values
—

getPhoto()

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

public getPhoto() : null|array<string|int, PhotoSize>

This method overrides the default getPhoto method and returns a nice array of PhotoSize objects.

Return values
null|array<string|int, PhotoSize> —

getPinnedMessage()

public getPinnedMessage() :

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

Return values
—

getProperty()

Get a property from the current Entity

public getProperty(mixed $property[, mixed $default = null ]) : mixed
Parameters
$property : mixed
$default : mixed = null
Return values
mixed —

getRawData()

public getRawData() :

Get the raw data passed to this entity

Return values
—

getReplyToMessage()

public getReplyToMessage() :

Optional. For replies, 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.

Return values
—

getSticker()

public getSticker() :

Optional. Message is a sticker, information about the sticker

Return values
—

getSuccessfulPayment()

public getSuccessfulPayment() :

Optional. Message is a service message about a successful payment, information about the payment.

Return values
—

getSupergroupChatCreated()

public getSupergroupChatCreated() :

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.

Return values
—

getText()

For text messages, the actual UTF-8 text of the message, 0-4096 characters.

public getText([bool $without_cmd = false ]) : string
Parameters
$without_cmd : bool = false
Return values
string —

getType()

Detect type based on properties.

public getType() : string
Return values
string —

getVenue()

public getVenue() :

Optional. Message is a venue, information about the venue

Return values
—

getVideo()

public getVideo() :

Optional. Message is a video, information about the video

Return values
—

getVideoNote()

public getVideoNote() :

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

Return values
—

getVoice()

public getVoice() :

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

Return values
—

toJson()

Perform to json

public toJson() : string
Return values
string —

tryMention()

Try to mention the user

public tryMention([bool $escape_markdown = false ]) : string|null

Mention the user with the username otherwise print first and last name if the $escape_markdown argument is true special characters are escaped from the output

Parameters
$escape_markdown : bool = false
Return values
string|null —

assignMemberVariables()

Helper to set member variables

protected assignMemberVariables(array<string|int, mixed> $data) : mixed
Parameters
$data : array<string|int, mixed>
Return values
mixed —

makePrettyObjectArray()

Return an array of nice objects from an array of object arrays

protected makePrettyObjectArray(string $class, string $property) : array<string|int, mixed>

This method is used to generate pretty object arrays mainly for PhotoSize and Entities object arrays.

Parameters
$class : string
$property : string
Return values
array<string|int, mixed> —

subEntities()

Get the list of the properties that are themselves Entities

protected subEntities() : array<string|int, mixed>
Return values
array<string|int, mixed> —

validate()

Perform any special entity validation

protected validate() : mixed
Tags
throws
TelegramException
Return values
mixed —

Search results