-
Notifications
You must be signed in to change notification settings - Fork 675
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add poll support #727
Merged
Merged
Add poll support #727
Changes from 3 commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
54ccc05
added poll type
arsamme 54034fb
complete poll object properties
arsamme 1ee5628
fixed space
arsamme d59cd54
removed idea folder from gitignore file and add it to global gitignor…
arsamme 184643c
solved code style problems
arsamme 753d7d8
solved code style problems
arsamme 18918bb
Merge branch 'add-poll-support' of https://github.com/arsamme/telegra…
arsamme ce5728f
solved code style problems
arsamme File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
composer.phar | ||
composer.lock | ||
vendor/ | ||
build/ | ||
build/ | ||
.idea/ | ||
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,53 +9,53 @@ | |
/** | ||
* Class Message. | ||
* | ||
* @property int $messageId Unique message identifier. | ||
* @property User $from (Optional). Sender, can be empty for messages sent to channels. | ||
* @property int $date Date the message was sent in Unix time. | ||
* @property Chat $chat Conversation the message belongs to. | ||
* @property User $forwardFrom (Optional). For forwarded messages, sender of the original message. | ||
* @property Chat $forwardFromChat (Optional). For messages forwarded from a channel, information about the original channel. | ||
* @property int $forwardFromMessageId (Optional). For forwarded channel posts, identifier of the original message in the channel. | ||
* @property string $forwardSignature (Optional). For messages forwarded from channels, identifier of the original message in the channel | ||
* @property string $forwardSenderName (Optional). Sender's name for messages forwarded from users who disallow adding a link to their account in forwarded messages | ||
* @property int $forwardDate (Optional). For forwarded messages, date the original message was sent in Unix time. | ||
* @property Message $replyToMessage (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. | ||
* @property int $editDate (Optional). Date the message was last edited in Unix time. | ||
* @property string $mediaGroupId (Optional). The unique identifier of a media message group this message belongs to | ||
* @property string $authorSignature (Optional). Signature of the post author for messages in channels | ||
* @property string $text (Optional). For text messages, the actual UTF-8 text of the message, 0-4096 characters. | ||
* @property MessageEntity[] $entities (Optional). For text messages, special entities like usernames, URLs, bot commands, etc. that appear in the text. | ||
* @property MessageEntity[] $captionEntities (Optional). For messages with a caption, special entities like usernames, URLs, bot commands, etc. that appear in the caption. | ||
* @property Audio $audio (Optional). Message is an audio file, information about the file. | ||
* @property Document $document (Optional). Message is a general file, information about the file. | ||
* @property Animation $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 | ||
* @property Game $game (Optional). Message is a game, information about the game. | ||
* @property PhotoSize[] $photo (Optional). Message is a photo, available sizes of the photo. | ||
* @property Sticker $sticker (Optional). Message is a sticker, information about the sticker. | ||
* @property Video $video (Optional). Message is a video, information about the video. | ||
* @property Voice $voice (Optional). Message is a voice message, information about the file. | ||
* @property VideoNote $videoNote (Optional). Message is a video note, information about the video message. | ||
* @property string $caption (Optional). Caption for the document, photo or video, 0-200 characters. | ||
* @property Contact $contact (Optional). Message is a shared contact, information about the contact. | ||
* @property Location $location (Optional). Message is a shared location, information about the location. | ||
* @property Venue $venue (Optional). Message is a venue, information about the venue. | ||
* @property Poll $poll (Optional). Message is a native poll, information about the poll | ||
* @property User[] $newChatMembers (Optional). New members that were added to the group or supergroup and information about them (the bot itself may be one of these members). | ||
* @property User $leftChatMember (Optional). A member was removed from the group, information about them (this member may be the bot itself). | ||
* @property string $newChatTitle (Optional). A chat title was changed to this value. | ||
* @property PhotoSize[] $newChatPhoto (Optional). A chat photo was change to this value. | ||
* @property bool $deleteChatPhoto (Optional). Service message: the chat photo was deleted. | ||
* @property bool $groupChatCreated (Optional). Service message: the group has been created. | ||
* @property bool $supergroupChatCreated (Optional). Service message: the super group has been created. | ||
* @property bool $channelChatCreated (Optional). Service message: the channel has been created. | ||
* @property int $migrateToChatId (Optional). The group has been migrated to a supergroup with the specified identifier, not exceeding 1e13 by absolute value. | ||
* @property int $migrateFromChatId (Optional). The supergroup has been migrated from a group with the specified identifier, not exceeding 1e13 by absolute value. | ||
* @property Message $pinnedMessage (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. | ||
* @property Invoice $invoice (Optional). Message is an invoice for a payment, information about the invoice. | ||
* @property int $messageId Unique message identifier. | ||
* @property User $from (Optional). Sender, can be empty for messages sent to channels. | ||
* @property int $date Date the message was sent in Unix time. | ||
* @property Chat $chat Conversation the message belongs to. | ||
* @property User $forwardFrom (Optional). For forwarded messages, sender of the original message. | ||
* @property Chat $forwardFromChat (Optional). For messages forwarded from a channel, information about the original channel. | ||
* @property int $forwardFromMessageId (Optional). For forwarded channel posts, identifier of the original message in the channel. | ||
* @property string $forwardSignature (Optional). For messages forwarded from channels, identifier of the original message in the channel | ||
* @property string $forwardSenderName (Optional). Sender's name for messages forwarded from users who disallow adding a link to their account in forwarded messages | ||
* @property int $forwardDate (Optional). For forwarded messages, date the original message was sent in Unix time. | ||
* @property Message $replyToMessage (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. | ||
* @property int $editDate (Optional). Date the message was last edited in Unix time. | ||
* @property string $mediaGroupId (Optional). The unique identifier of a media message group this message belongs to | ||
* @property string $authorSignature (Optional). Signature of the post author for messages in channels | ||
* @property string $text (Optional). For text messages, the actual UTF-8 text of the message, 0-4096 characters. | ||
* @property MessageEntity[] $entities (Optional). For text messages, special entities like usernames, URLs, bot commands, etc. that appear in the text. | ||
* @property MessageEntity[] $captionEntities (Optional). For messages with a caption, special entities like usernames, URLs, bot commands, etc. that appear in the caption. | ||
* @property Audio $audio (Optional). Message is an audio file, information about the file. | ||
* @property Document $document (Optional). Message is a general file, information about the file. | ||
* @property Animation $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 | ||
* @property Game $game (Optional). Message is a game, information about the game. | ||
* @property PhotoSize[] $photo (Optional). Message is a photo, available sizes of the photo. | ||
* @property Sticker $sticker (Optional). Message is a sticker, information about the sticker. | ||
* @property Video $video (Optional). Message is a video, information about the video. | ||
* @property Voice $voice (Optional). Message is a voice message, information about the file. | ||
* @property VideoNote $videoNote (Optional). Message is a video note, information about the video message. | ||
* @property string $caption (Optional). Caption for the document, photo or video, 0-200 characters. | ||
* @property Contact $contact (Optional). Message is a shared contact, information about the contact. | ||
* @property Location $location (Optional). Message is a shared location, information about the location. | ||
* @property Venue $venue (Optional). Message is a venue, information about the venue. | ||
* @property Poll $poll (Optional). Message is a native poll, information about the poll | ||
* @property User[] $newChatMembers (Optional). New members that were added to the group or supergroup and information about them (the bot itself may be one of these members). | ||
* @property User $leftChatMember (Optional). A member was removed from the group, information about them (this member may be the bot itself). | ||
* @property string $newChatTitle (Optional). A chat title was changed to this value. | ||
* @property PhotoSize[] $newChatPhoto (Optional). A chat photo was change to this value. | ||
* @property bool $deleteChatPhoto (Optional). Service message: the chat photo was deleted. | ||
* @property bool $groupChatCreated (Optional). Service message: the group has been created. | ||
* @property bool $supergroupChatCreated (Optional). Service message: the super group has been created. | ||
* @property bool $channelChatCreated (Optional). Service message: the channel has been created. | ||
* @property int $migrateToChatId (Optional). The group has been migrated to a supergroup with the specified identifier, not exceeding 1e13 by absolute value. | ||
* @property int $migrateFromChatId (Optional). The supergroup has been migrated from a group with the specified identifier, not exceeding 1e13 by absolute value. | ||
* @property Message $pinnedMessage (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. | ||
* @property Invoice $invoice (Optional). Message is an invoice for a payment, information about the invoice. | ||
* @property SuccessfulPayment $successfulPayment (Optional). Message is a service message about a successful payment, information about the payment. | ||
* @property string $connectedWebsite (Optional). The domain name of the website on which the user has logged in. | ||
* @property PassportData $passportData (Optional). Telegram Passport data | ||
* @property string $replyMarkup (Optional). Inline keyboard attached to the message. login_url buttons are represented as ordinary url buttons. | ||
* @property string $connectedWebsite (Optional). The domain name of the website on which the user has logged in. | ||
* @property PassportData $passportData (Optional). Telegram Passport data | ||
* @property string $replyMarkup (Optional). Inline keyboard attached to the message. login_url buttons are represented as ordinary url buttons. | ||
*/ | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Please maintain the code styling. |
||
class Message extends BaseObject | ||
{ | ||
|
@@ -65,39 +65,40 @@ class Message extends BaseObject | |
public function relations() | ||
{ | ||
return [ | ||
'from' => User::class, | ||
'chat' => Chat::class, | ||
'forward_from' => User::class, | ||
'forward_from_chat' => Chat::class, | ||
'reply_to_message' => self::class, | ||
'entities' => MessageEntity::class, | ||
'caption_entities' => MessageEntity::class, | ||
'audio' => Audio::class, | ||
'document' => Document::class, | ||
'animation' => Animation::class, | ||
'game' => Game::class, | ||
'photo' => PhotoSize::class, | ||
'sticker' => Sticker::class, | ||
'video' => Video::class, | ||
'voice' => Voice::class, | ||
'video_note' => VideoNote::class, | ||
'contact' => Contact::class, | ||
'location' => Location::class, | ||
'venue' => Venue::class, | ||
'new_chat_members' => User::class, | ||
'left_chat_member' => User::class, | ||
'new_chat_photo' => PhotoSize::class, | ||
'pinned_message' => self::class, | ||
'invoice' => Invoice::class, | ||
'from' => User::class, | ||
'chat' => Chat::class, | ||
'forward_from' => User::class, | ||
'forward_from_chat' => Chat::class, | ||
'reply_to_message' => self::class, | ||
'entities' => MessageEntity::class, | ||
'caption_entities' => MessageEntity::class, | ||
'audio' => Audio::class, | ||
'document' => Document::class, | ||
'animation' => Animation::class, | ||
'game' => Game::class, | ||
'photo' => PhotoSize::class, | ||
'sticker' => Sticker::class, | ||
'video' => Video::class, | ||
'voice' => Voice::class, | ||
'video_note' => VideoNote::class, | ||
'contact' => Contact::class, | ||
'location' => Location::class, | ||
'venue' => Venue::class, | ||
'poll' => Poll::class, | ||
'new_chat_members' => User::class, | ||
'left_chat_member' => User::class, | ||
'new_chat_photo' => PhotoSize::class, | ||
'pinned_message' => self::class, | ||
'invoice' => Invoice::class, | ||
'successful_payment' => SuccessfulPayment::class, | ||
'passport' => PassportData::class, | ||
'passport' => PassportData::class, | ||
]; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Code styling! |
||
} | ||
|
||
/** | ||
* Determine if the message is of given type. | ||
* | ||
* @param string $type | ||
* @param string $type | ||
* | ||
* @return bool | ||
*/ | ||
|
@@ -129,6 +130,7 @@ public function detectType() | |
'contact', | ||
'location', | ||
'venue', | ||
'poll', | ||
'new_chat_member', | ||
'left_chat_member', | ||
'new_chat_title', | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please remove the
.idea
from this file. It should go in your global gitignore file.