Options
All
  • Public
  • Public/Protected
  • All
Menu

Interface IterMessagesParams

Interface for iterating over messages. used in both iterMessages and getMessages.

Hierarchy

  • IterMessagesParams

Index

Properties

limit?: number

Number of messages to be retrieved.
Due to limitations with the API retrieving more than 3000 messages will take longer than half a minute. (might even take longer)
if undefined is passed instead of a number the library will try to retrieve all the messages.

offsetDate?: number

Offset date (messages previous to this date will be retrieved). Exclusive.

offsetId: number

Offset message ID (only messages previous to the given ID will be retrieved). Exclusive.

maxId: number

All the messages with a higher (newer) ID or equal to this will be excluded.

minId: number

All the messages with a lower (older) ID or equal to this will be excluded.

addOffset: number

Additional message offset (all of the specified offsets + this offset = older messages).

search?: string

The string to be used as a search query.

The filter to use when returning messages.
For instance, InputMessagesFilterPhotos would yield only messages containing photos.

fromUser?: EntityLike

Only messages from this user will be returned.

waitTime?: number

Wait time (in seconds) between different GetHistory requests.
Use this parameter to avoid hitting the FloodWaitError as needed.
If left to undefined, it will default to 1 second only if the number of messages is higher than 3000. If the ids parameter is used, this time will default to 10 seconds only if the amount of IDs is higher than 300.

ids?: number | number[] | TypeInputMessage | TypeInputMessage[]

A single integer ID (or several IDs) for the message that should be returned.
This parameter takes precedence over the rest (which will be ignored if this is set).
This can for instance be used to get the message with ID 123 from a channel.
Note that if the message doesn"t exist, undefined will appear in its place.

reverse?: boolean

If set to true, the messages will be returned in reverse order (from oldest to newest, instead of the default newest to oldest).
This also means that the meaning of offsetId and offsetDate parameters is reversed, although they will still be exclusive.
minId becomes equivalent to offsetId instead of being maxId as well since messages are returned in ascending order.
You cannot use this if both entity and ids are undefined.

replyTo?: number

If set to a message ID, the messages that reply to this ID will be returned.
This feature is also known as comments in posts of broadcast channels, or viewing threads in groups.
This feature can only be used in broadcast channels and their linked supergroups. Using it in a chat or private conversation will result in PEER_ID_INVALID error.
When using this parameter, the filter and search parameters have no effect, since Telegram's API doesn't support searching messages in replies.

scheduled: boolean

If set to true, messages which are scheduled will be returned. All other parameters will be ignored for this, except entity.

Generated using TypeDoc