Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 18 additions & 4 deletions src/DB.php
Original file line number Diff line number Diff line change
Expand Up @@ -720,7 +720,9 @@ public static function insertMessageRequest(Message $message)
self::insertChat($chat, $date, $migrate_to_chat_id);

//Insert user and the relation with the chat
self::insertUser($from, $date, $chat);
if (is_object($from)) {
self::insertUser($from, $date, $chat);
}

//Insert the forwarded message user in users table
if ($forward_from instanceof User) {
Expand Down Expand Up @@ -769,7 +771,12 @@ public static function insertMessageRequest(Message $message)
');

$message_id = $message->getMessageId();
$from_id = $from->getId();

if (is_object($from)) {
$from_id = $from->getId();
} else {
$from_id = null;
}

$reply_to_message = $message->getReplyToMessage();
$reply_to_message_id = null;
Expand Down Expand Up @@ -871,7 +878,9 @@ public static function insertEditedMessageRequest(Message $edited_message)
self::insertChat($chat, $edit_date);

//Insert user and the relation with the chat
self::insertUser($from, $edit_date, $chat);
if (is_object($from)) {
self::insertUser($from, $edit_date, $chat);
}

try {
$sth = self::$pdo->prepare('
Expand All @@ -882,7 +891,12 @@ public static function insertEditedMessageRequest(Message $edited_message)
');

$message_id = $edited_message->getMessageId();
$from_id = $from->getId();

if (is_object($from)) {
$from_id = $from->getId();
} else {
$from_id = null;
}

$text = $edited_message->getText();
$caption = $edited_message->getCaption();
Expand Down
2 changes: 1 addition & 1 deletion src/Entities/ServerResponse.php
Original file line number Diff line number Diff line change
Expand Up @@ -101,8 +101,8 @@ private function createResultObject($result, $bot_name)
$result_object_types = [
'total_count' => 'UserProfilePhotos', //Response from getUserProfilePhotos
'file_id' => 'File', //Response from getFile
'title' => 'Chat', //Response from getChat
'username' => 'User', //Response from getMe
'id' => 'Chat', //Response from getChat
'user' => 'ChatMember', //Response from getChatMember
'url' => 'WebhookInfo', //Response from getWebhookInfo
];
Expand Down