Telethon/methods/messages/get_history.html

32 lines
6.2 KiB
HTML
Raw Normal View History

2016-08-26 13:58:53 +03:00
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>GetHistoryRequest</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link id="style" href="../../css/docs.dark.css" rel="stylesheet">
<script>
document.getElementById("style").href = "../../css/docs."
+ (localStorage.getItem("theme") || "light")
+ ".css";
</script>
<link href="https://fonts.googleapis.com/css?family=Nunito|Source+Code+Pro"
rel="stylesheet">
</head>
<body>
<div id="main_div"><ul class="horizontal"><li><a href="../../index.html">API</a></li><img src="../../img/arrow.svg" alt="/" /><li><a href="../index.html">Methods</a></li><img src="../../img/arrow.svg" alt="/" /><li><a href="index.html">Messages</a></li><img src="../../img/arrow.svg" alt="/" /><li><a href="get_history.html">GetHistoryRequest</a></li></ul><h1>GetHistoryRequest</h1><p><strong>Only users</strong> can use this request. <a href="#examples">See code examples.</a></p><pre>---functions---
messages.getHistory#4423e6c5 peer:<a href="../../types/input_peer.html">InputPeer</a> offset_id:<a href="../../index.html#int">int</a> offset_date:<a href="../../index.html#date">date</a> add_offset:<a href="../../index.html#int">int</a> limit:<a href="../../index.html#int">int</a> max_id:<a href="../../index.html#int">int</a> min_id:<a href="../../index.html#int">int</a> hash:<a href="../../index.html#long">long</a> = <a href="../../types/messages/messages.html">messages.Messages</a></pre><button onclick="cp('from telethon.tl.functions.messages import GetHistoryRequest');">Copy import to the clipboard</button><h3>Returns</h3><table><tr><td><a href="../../types/messages/messages.html">messages.Messages</a></td></tr></table><p>This type can be an instance of either:</p><table><tr><td><a href="../../constructors/messages/channel_messages.html">ChannelMessages</a></td><td><a href="../../constructors/messages/messages.html">Messages</a></td></tr><tr><td><a href="../../constructors/messages/messages_not_modified.html">MessagesNotModified</a></td><td><a href="../../constructors/messages/messages_slice.html">MessagesSlice</a></td></tr></table><h3>Parameters</h3><table><tr><td><b>peer</b></td><td style="text-align:center"><a href="../../types/input_peer.html">InputPeer</a></td><td>Anything entity-like will work if the library can find its <code>Input</code> version (e.g., usernames, <code>Peer</code>, <code>User</code> or <code>Channel</code> objects, etc.).</td></tr><tr><td><b>offset_id</b></td><td style="text-align:center"><a href="../../index.html#int">int</a></td><td></td></tr><tr><td><b>offset_date</b></td><td style="text-align:center"><a href="../../index.html#date">date</a></td><td></td></tr><tr><td><b>add_offset</b></td><td style="text-align:center"><a href="../../index.html#int">int</a></td><td></td></tr><tr><td><b>limit</b></td><td style="text-align:center"><a href="../../index.html#int">int</a></td><td></td></tr><tr><td><b>max_id</b></td><td style="text-align:center"><a href="../../index.html#int">int</a></td><td></td></tr><tr><td><b>min_id</b></td><td style="text-align:center"><a href="../../index.html#int">int</a></td><td></td></tr><tr><td><b>hash</b></td><td style="text-align:center"><a href="../../index.html#long">long</a></td><td></td></tr></table><h1>Known RPC errors</h1><p>This request can cause 7 known errors:</p><table><tr><td><code>AuthKeyDuplicatedError</code></td><td>The authorization key (session file) was used under two different IP addresses simultaneously, and can no longer be used. Use the same session exclusively, or use different sessions.</td></tr><tr><td><code>AuthKeyPermEmptyError</code></td><td>The method is unavailable for temporary authorization key, not bound to permanent.</td></tr><tr><td><code>ChannelInvalidError</code></td><td>Invalid channel object. Make sure to pass the right types, for instance making sure that the request is designed for channels or otherwise look for a different one more suited.</td></tr><tr><td><code>ChannelPrivateError</code></td><td>The channel specified is private and you lack permission to access it. Another reason may be that you were banned from it.</td></tr><tr><td><code>ChatIdInvalidError</code></td><td>Invalid object ID for a chat. Make sure to pass the right types, for instance making sure that the request is designed for chats (not channels/megagroups) or otherwise look for a different one more suited\nAn example working with a megagroup and AddChatUserRequest, it will fail because megagroups are channels. Use InviteToChannelRequest instead.</td></tr><tr><td><code>PeerIdInvalidError</code></td><td>An invalid Peer was used. Make sure to pass the right peer type and that the value is valid (for instance, bots cannot start conversations).</td></tr><tr><td><code>TimeoutError</code></td><td>A timeout occurred while fetching data from the worker.</td></tr></table><p>You can import these from <code>telethon.errors</code>.</p><h1 id="examples">Example</h1><p>Please refer to the documentation of <a href="https://docs.telethon.dev/en/stable/modules/client.html#tele
<strong>from</strong> telethon <strong>import</strong> functions, types
<strong>with</strong> TelegramClient(name, api_id, api_hash) <strong>as</strong> client:
result = client(functions.messages.GetHistoryRequest(
peer=<em>'username'</em>,
offset_id=42,
offset_date=datetime.datetime(2018, 6, 25),
add_offset=0,
limit=100,
max_id=0,
min_id=0,
hash=-12398745604826
))
print(result.stringify())</pre></details><textarea id="c" class="invisible"></textarea><script>function cp(t){var c=document.getElementById("c");c.value=t;c.select();try{document.execCommand("copy")}catch(e){}}</script></div><script>prependPath = "../../";</script><script src="../../js/search.js"></script></body></html>