GetChannelDifferenceRequest
Both users and bots can use this request. See code examples.
---functions--- updates.getChannelDifference#03173d78 flags:# force:flags.0?true channel:InputChannel filter:ChannelMessagesFilter pts:int limit:int = updates.ChannelDifference
Returns
updates.ChannelDifference |
This type can be an instance of either:
ChannelDifference | ChannelDifferenceEmpty |
ChannelDifferenceTooLong |
Parameters
channel | InputChannel | Anything entity-like will work if the library can find its Input version (e.g., usernames, Peer , User or Channel objects, etc.). |
filter | ChannelMessagesFilter | |
pts | int | |
limit | int | |
force | flag | This argument defaults to None and can be omitted. |
Known RPC errors
This request can cause 9 known errors:
ChannelInvalidError | 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. |
ChannelPrivateError | The channel specified is private and you lack permission to access it. Another reason may be that you were banned from it. |
ChannelPublicGroupNaError | channel/supergroup not available. |
HistoryGetFailedError | Fetching of history failed. |
PersistentTimestampEmptyError | Persistent timestamp empty. |
PersistentTimestampInvalidError | Persistent timestamp invalid. |
PersistentTimestampOutdatedError | Persistent timestamp outdated. |
RangesInvalidError | Invalid range provided. |
TimeoutError | A timeout occurred while fetching data from the worker. |
You can import these from telethon.errors
.
Example
Please refer to the documentation of client.catch_up()
to learn about the parameters and see several code examples on how to use it.
The method above is the recommended way to do it. If you need more control over the parameters or want to learn how it is implemented, open the details by clicking on the "Details" text.
from telethon.sync import TelegramClient from telethon import functions, types with TelegramClient(name, api_id, api_hash) as client: result = client(functions.updates.GetChannelDifferenceRequest( channel='username', filter=types.ChannelMessagesFilter( ranges=[types.MessageRange( min_id=0, max_id=0 )], exclude_new_messages=True ), pts=42, limit=100, force=True )) print(result.stringify())