Add forward_from_message_id field to Message entity, including DB table.

parent 1c54e2c0
......@@ -733,14 +733,15 @@ class DB
$date = self::getTimestamp($message->getDate());
$forward_from = $message->getForwardFrom();
$forward_from_chat = $message->getForwardFromChat();
$photo = self::entitiesArrayToJson($message->getPhoto(), '');
$entities = self::entitiesArrayToJson($message->getEntities(), null);
$new_chat_member = $message->getNewChatMember();
$new_chat_photo = self::entitiesArrayToJson($message->getNewChatPhoto(), '');
$left_chat_member = $message->getLeftChatMember();
$migrate_to_chat_id = $message->getMigrateToChatId();
$forward_from = $message->getForwardFrom();
$forward_from_chat = $message->getForwardFromChat();
$forward_from_message_id = $message->getForwardFromMessageId();
$photo = self::entitiesArrayToJson($message->getPhoto(), '');
$entities = self::entitiesArrayToJson($message->getEntities(), null);
$new_chat_member = $message->getNewChatMember();
$new_chat_photo = self::entitiesArrayToJson($message->getNewChatPhoto(), '');
$left_chat_member = $message->getLeftChatMember();
$migrate_to_chat_id = $message->getMigrateToChatId();
//Insert chat, update chat id in case it migrated
self::insertChat($chat, $date, $migrate_to_chat_id);
......@@ -778,7 +779,7 @@ class DB
$sth = self::$pdo->prepare('
INSERT IGNORE INTO `' . TB_MESSAGE . '`
(
`id`, `user_id`, `chat_id`, `date`, `forward_from`, `forward_from_chat`,
`id`, `user_id`, `chat_id`, `date`, `forward_from`, `forward_from_chat`, `forward_from_message_id`,
`forward_date`, `reply_to_chat`, `reply_to_message`, `text`, `entities`, `audio`, `document`,
`photo`, `sticker`, `video`, `voice`, `caption`, `contact`,
`location`, `venue`, `new_chat_member`, `left_chat_member`,
......@@ -786,7 +787,7 @@ class DB
`supergroup_chat_created`, `channel_chat_created`,
`migrate_from_chat_id`, `migrate_to_chat_id`, `pinned_message`
) VALUES (
:message_id, :user_id, :chat_id, :date, :forward_from, :forward_from_chat,
:message_id, :user_id, :chat_id, :date, :forward_from, :forward_from_chat, :forward_from_message_id,
:forward_date, :reply_to_chat, :reply_to_message, :text, :entities, :audio, :document,
:photo, :sticker, :video, :voice, :caption, :contact,
:location, :venue, :new_chat_member, :left_chat_member,
......@@ -838,6 +839,7 @@ class DB
$sth->bindParam(':date', $date, PDO::PARAM_STR);
$sth->bindParam(':forward_from', $forward_from, PDO::PARAM_INT);
$sth->bindParam(':forward_from_chat', $forward_from_chat, PDO::PARAM_INT);
$sth->bindParam(':forward_from_message_id', $forward_from_message_id, PDO::PARAM_INT);
$sth->bindParam(':forward_date', $forward_date, PDO::PARAM_STR);
$reply_to_chat_id = null;
......
......@@ -21,6 +21,7 @@ namespace Longman\TelegramBot\Entities;
* @method Chat getChat() Conversation the message belongs to
* @method User getForwardFrom() Optional. For forwarded messages, sender of the original message
* @method Chat getForwardFromChat() Optional. For messages forwarded from a channel, information about the original channel
* @method int getForwardFromMessageId() Optional. For forwarded channel posts, identifier of the original message in the channel
* @method int getForwardDate() Optional. For forwarded messages, date the original message was sent in Unix time
* @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.
* @method int getEditDate() Optional. Date the message was last edited in Unix time
......
......@@ -70,6 +70,7 @@ CREATE TABLE IF NOT EXISTS `message` (
`date` timestamp NULL DEFAULT NULL COMMENT 'Date the message was sent in timestamp format',
`forward_from` bigint NULL DEFAULT NULL COMMENT 'Unique user identifier, sender of the original message',
`forward_from_chat` bigint NULL DEFAULT NULL COMMENT 'Unique chat identifier, chat the original message belongs to',
`forward_from_message_id` bigint NULL DEFAULT NULL COMMENT 'Unique chat identifier of the original message in the channel',
`forward_date` timestamp NULL DEFAULT NULL COMMENT 'date the original message was sent in timestamp format',
`reply_to_chat` bigint NULL DEFAULT NULL COMMENT 'Unique chat identifier',
`reply_to_message` bigint UNSIGNED DEFAULT NULL COMMENT 'Message that this message is reply to',
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment