|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
namespace Telegram\Bot\Objects; |
|
4
|
|
|
|
|
5
|
|
|
use Telegram\Bot\Helpers\Emojify; |
|
6
|
|
|
|
|
7
|
|
|
/** |
|
8
|
|
|
* Class Message. |
|
9
|
|
|
* |
|
10
|
|
|
* |
|
11
|
|
|
* @method int getMessageId() Unique message identifier. |
|
12
|
|
|
* @method User getFrom() (Optional). Sender, can be empty for messages sent to channels. |
|
13
|
|
|
* @method int getDate() Date the message was sent in Unix time. |
|
14
|
|
|
* @method Chat getChat() Conversation the message belongs to. |
|
15
|
|
|
* @method User getForwardFrom() (Optional). For forwarded messages, sender of the original message. |
|
16
|
|
|
* @method int getForwardDate() (Optional). For forwarded messages, date the original message was sent in Unix time. |
|
17
|
|
|
* @method Message 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. |
|
18
|
|
|
* @method MessageEntity[] getEntities() (Optional). For text messages, special entities like usernames, URLs, bot commands, etc. that appear in the text. |
|
19
|
|
|
* @method Audio getAudio() (Optional). Message is an audio file, information about the file. |
|
20
|
|
|
* @method Document getDocument() (Optional). Message is a general file, information about the file. |
|
21
|
|
|
* @method PhotoSize[] getPhoto() (Optional). Message is a photo, available sizes of the photo. |
|
22
|
|
|
* @method Sticker getSticker() (Optional). Message is a sticker, information about the sticker. |
|
23
|
|
|
* @method Video getVideo() (Optional). Message is a video, information about the video. |
|
24
|
|
|
* @method Voice getVoice() (Optional). Message is a voice message, information about the file. |
|
25
|
|
|
* @method string getCaption() (Optional). Caption for the document, photo or video contact. |
|
26
|
|
|
* @method Contact getContact() (Optional). Message is a shared contact, information about the contact. |
|
27
|
|
|
* @method Location getLocation() (Optional). Message is a shared location, information about the location. |
|
28
|
|
|
* @method Venue getVenue() (Optional). Message is a venue, information about the venue. |
|
29
|
|
|
* @method User getNewChatMember() (Optional). A new member was added to the group, information about them (this member may be the bot itself). |
|
30
|
|
|
* @method User getLeftChatMember() (Optional). A member was removed from the group, information about them (this member may be the bot itself). |
|
31
|
|
|
* @method string getNewChatTitle() (Optional). A chat title was changed to this value. |
|
32
|
|
|
* @method PhotoSize[] getNewChatPhoto() (Optional). A chat photo was change to this value. |
|
33
|
|
|
* @method bool getDeleteChatPhoto() (Optional). Service message: the chat photo was deleted. |
|
34
|
|
|
* @method bool getGroupChatCreated() (Optional). Service message: the group has been created. |
|
35
|
|
|
* @method bool getSupergroupChatCreated() (Optional). Service message: the super group has been created. |
|
36
|
|
|
* @method bool getChannelChatCreated() (Optional). Service message: the channel has been created. |
|
37
|
|
|
* @method int getMigrateToChatId() (Optional). The group has been migrated to a supergroup with the specified identifier, not exceeding 1e13 by absolute value. |
|
38
|
|
|
* @method int getMigrateFromChatId() (Optional). The supergroup has been migrated from a group with the specified identifier, not exceeding 1e13 by absolute value. |
|
39
|
|
|
* @method Message 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. |
|
40
|
|
|
*/ |
|
41
|
|
|
class Message extends BaseObject |
|
42
|
|
|
{ |
|
43
|
|
|
/** |
|
44
|
|
|
* {@inheritdoc} |
|
45
|
|
|
*/ |
|
46
|
30 |
|
public function relations() |
|
47
|
|
|
{ |
|
48
|
|
|
return [ |
|
49
|
30 |
|
'from' => User::class, |
|
50
|
30 |
|
'chat' => Chat::class, |
|
51
|
30 |
|
'forward_from' => User::class, |
|
52
|
30 |
|
'reply_to_message' => self::class, |
|
53
|
30 |
|
'entities' => MessageEntity::class, |
|
54
|
30 |
|
'audio' => Audio::class, |
|
55
|
30 |
|
'document' => Document::class, |
|
56
|
30 |
|
'photo' => PhotoSize::class, |
|
57
|
30 |
|
'sticker' => Sticker::class, |
|
58
|
30 |
|
'video' => Video::class, |
|
59
|
30 |
|
'voice' => Voice::class, |
|
60
|
30 |
|
'contact' => Contact::class, |
|
61
|
30 |
|
'location' => Location::class, |
|
62
|
30 |
|
'venue' => Venue::class, |
|
63
|
30 |
|
'new_chat_member' => User::class, |
|
64
|
30 |
|
'left_chat_member' => User::class, |
|
65
|
30 |
|
'new_chat_photo' => PhotoSize::class, |
|
66
|
30 |
|
'pinned_message' => Message::class, |
|
67
|
30 |
|
]; |
|
68
|
|
|
} |
|
69
|
|
|
|
|
70
|
|
|
/** |
|
71
|
|
|
* (Optional). For text messages, the actual UTF-8 text of the message. |
|
72
|
|
|
* |
|
73
|
|
|
* @return string |
|
74
|
|
|
*/ |
|
75
|
8 |
|
public function getText() |
|
76
|
|
|
{ |
|
77
|
8 |
|
return Emojify::translate($this->get('text')); |
|
78
|
|
|
} |
|
79
|
|
|
} |
|
80
|
|
|
|