Skip to content

Commit 8f0bd3d

Browse files
committed
Add missing PassportData fields in Message and save to DB
1 parent ff8d064 commit 8f0bd3d

File tree

4 files changed

+11
-4
lines changed

4 files changed

+11
-4
lines changed

src/DB.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -833,15 +833,15 @@ public static function insertMessageRequest(Message $message)
833833
`location`, `venue`, `new_chat_members`, `left_chat_member`,
834834
`new_chat_title`,`new_chat_photo`, `delete_chat_photo`, `group_chat_created`,
835835
`supergroup_chat_created`, `channel_chat_created`,
836-
`migrate_from_chat_id`, `migrate_to_chat_id`, `pinned_message`, `connected_website`
836+
`migrate_from_chat_id`, `migrate_to_chat_id`, `pinned_message`, `connected_website`, `passport_data`
837837
) VALUES (
838838
:message_id, :user_id, :chat_id, :date, :forward_from, :forward_from_chat, :forward_from_message_id,
839839
:forward_date, :reply_to_chat, :reply_to_message, :media_group_id, :text, :entities, :audio, :document,
840840
:animation, :game, :photo, :sticker, :video, :voice, :video_note, :caption, :contact,
841841
:location, :venue, :new_chat_members, :left_chat_member,
842842
:new_chat_title, :new_chat_photo, :delete_chat_photo, :group_chat_created,
843843
:supergroup_chat_created, :channel_chat_created,
844-
:migrate_from_chat_id, :migrate_to_chat_id, :pinned_message, :connected_website
844+
:migrate_from_chat_id, :migrate_to_chat_id, :pinned_message, :connected_website, :passport_data
845845
)
846846
');
847847

@@ -904,6 +904,7 @@ public static function insertMessageRequest(Message $message)
904904
$sth->bindValue(':migrate_to_chat_id', $message->getMigrateToChatId());
905905
$sth->bindValue(':pinned_message', $message->getPinnedMessage());
906906
$sth->bindValue(':connected_website', $message->getConnectedWebsite());
907+
$sth->bindValue(':passport_data', $message->getPassportData());
907908

908909
return $sth->execute();
909910
} catch (PDOException $e) {

src/Entities/Message.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
use Longman\TelegramBot\Entities\Games\Game;
1414
use Longman\TelegramBot\Entities\Payments\Invoice;
1515
use Longman\TelegramBot\Entities\Payments\SuccessfulPayment;
16+
use Longman\TelegramBot\Entities\TelegramPassport\PassportData;
1617

1718
/**
1819
* Class Message
@@ -56,6 +57,7 @@
5657
* @method Invoice getInvoice() Optional. Message is an invoice for a payment, information about the invoice.
5758
* @method SuccessfulPayment getSuccessfulPayment() Optional. Message is a service message about a successful payment, information about the payment.
5859
* @method string getConnectedWebsite() Optional. The domain name of the website on which the user has logged in.
60+
* @method PassportData getPassportData() Optional. Telegram Passport data
5961
*/
6062
class Message extends Entity
6163
{
@@ -90,6 +92,7 @@ protected function subEntities()
9092
'pinned_message' => Message::class,
9193
'invoice' => Invoice::class,
9294
'successful_payment' => SuccessfulPayment::class,
95+
'passport_data' => PassportData::class,
9396
];
9497
}
9598

@@ -304,6 +307,7 @@ public function getType()
304307
'pinned_message',
305308
'invoice',
306309
'successful_payment',
310+
'passport_data',
307311
];
308312

309313
$is_command = strlen($this->getCommand()) > 0;

structure.sql

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ CREATE TABLE IF NOT EXISTS `message` (
8181
`entities` TEXT COMMENT 'For text messages, special entities like usernames, URLs, bot commands, etc. that appear in the text',
8282
`audio` TEXT COMMENT 'Audio object. Message is an audio file, information about the file',
8383
`document` TEXT COMMENT 'Document object. Message is a general file, information about the file',
84-
`animation` TEXT COMMENT 'Optional. Message is an animation, information about the animation',
84+
`animation` TEXT COMMENT 'Message is an animation, information about the animation',
8585
`game` TEXT COMMENT 'Game object. Message is a game, information about the game',
8686
`photo` TEXT COMMENT 'Array of PhotoSize objects. Message is a photo, available sizes of the photo',
8787
`sticker` TEXT COMMENT 'Sticker object. Message is a sticker, information about the sticker',
@@ -104,6 +104,7 @@ CREATE TABLE IF NOT EXISTS `message` (
104104
`migrate_from_chat_id` bigint NULL DEFAULT NULL COMMENT 'Migrate from chat identifier. The supergroup has been migrated from a group with the specified identifier',
105105
`pinned_message` TEXT NULL COMMENT 'Message object. Specified message was pinned',
106106
`connected_website` TEXT NULL COMMENT 'The domain name of the website on which the user has logged in.',
107+
`passport_data` TEXT NULL COMMENT 'Telegram Passport data',
107108

108109
PRIMARY KEY (`chat_id`, `id`),
109110
KEY `user_id` (`user_id`),
Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
1-
ALTER TABLE `message` ADD COLUMN `animation` TEXT NULL COMMENT 'Optional. Message is an animation, information about the animation' AFTER `document`;
1+
ALTER TABLE `message` ADD COLUMN `animation` TEXT NULL COMMENT 'Message is an animation, information about the animation' AFTER `document`;
2+
ALTER TABLE `message` ADD COLUMN `passport_data` TEXT NULL COMMENT 'Telegram Passport data' AFTER `connected_website`;

0 commit comments

Comments
 (0)