danog/MadelineProto

messages.gethistory and messages.search return no messages

iamcrang opened this issue · 1 comments

Hello, thank you for the great library.

I'm trying to fetch messages from a public channel starting from certain message.id
Used 2 methods, getHistory and search, both returns the same result:

$messages_Messages = $MadelineProto->messages->getHistory(peer: $channel, offset_id: $offset_id, limit: $limit, min_id: $offset_id);
$messages_Messages = $MadelineProto->messages->search(filter: ['_' => 'inputMessagesFilterEmpty'], peer: $channel, offset_id: $offset_id, limit: $limit, min_id: $offset_id);

$offset_id is the latest message id from my database, it is less than the latest message id in the channel
$limit = 100;

{
	"_": "messages.channelMessages",
	"inexact": false,
	"pts": 62852,
	"count": 18231,
	"offset_id_offset": 19,
	"messages": [],
	"topics": [],
	"chats": [],
	"users": []
}

Tell me please, how can I get latest messages (with id greater than provided id in $offset_id) and why I getting no messages?

Thank you in advance.

Please only use the event handler to fetch new messages.