mirror of
https://github.com/danog/MadelineProtoDocs.git
synced 2024-12-11 16:50:37 +01:00
2.8 KiB
2.8 KiB
title | description | grand_parent | parent | image | redirect_from |
---|---|---|---|---|---|
messages.getHistory | Returns the conversation history with one interlocutor / within a chat | Telegram RPC API | Methods | https://docs.madelineproto.xyz/favicons/android-chrome-256x256.png | /API_docs/methods/messages_getHistory.html |
Method: messages.getHistory
Warning: flood wait
Warning: this method is prone to rate limiting with flood waits, which can lead to !!! ACCOUNT BANS !!!, please use the updates event handler, instead (which is 100% safe) »
Warning: non-realtime results
Warning: this method is not suitable for receiving messages in real-time from chats and users, please use the updates event handler, instead »
Warning: this is probably NOT what you need
You probably need to use the updates event handler, instead » :)
Returns the conversation history with one interlocutor / within a chat
Parameters:
Name | Type | Description | Required |
---|---|---|---|
peer | Username, chat ID, Update, Message or InputPeer | Target peer | Optional |
offset_id | int | Only return messages starting from the specified message ID | Optional |
offset_date | int | Only return messages sent before the specified date | Optional |
add_offset | int | Number of list elements to be skipped, negative values are also accepted. | Optional |
limit | int | Number of results to return | Optional |
max_id | int | If a positive value was transferred, the method will return only messages with IDs less than max_id | Optional |
min_id | int | If a positive value was transferred, the method will return only messages with IDs more than min_id | Optional |
hash | Array of [long | string](/API_docs/types/long | string.html) |
Return type: messages.Messages
Can bots use this method: NO
MadelineProto Example (now async for huge speed and parallelism!):
if (!file_exists('madeline.php')) {
copy('https://phar.madelineproto.xyz/madeline.php', 'madeline.php');
}
include 'madeline.php';
$MadelineProto = new \danog\MadelineProto\API('session.madeline');
$MadelineProto->start();
$messages_Messages = $MadelineProto->messages->getHistory(peer: $InputPeer, offset_id: $int, offset_date: $int, add_offset: $int, limit: $int, max_id: $int, min_id: $int, hash: [$long|string, $long|string], );