• Get chat history.

    Parameters

    • client: ITelegramClient
    • chatId: InputPeerLike

      Chat's marked ID, its username, phone or "me" or "self".

    • Optionalparams: {
          addOffset?: number;
          limit?: number;
          maxId?: number;
          minId?: number;
          offset?: GetHistoryOffset;
          reverse?: boolean;
      }

      Additional fetch parameters

      • OptionaladdOffset?: number

        Additional offset from offset, in resulting messages.

        This can be used for advanced use cases, like:

        • Loading 20 messages newer than message with ID MSGID: offset = MSGID, addOffset = -20, limit = 20
        • Loading 20 messages around message with ID MSGID: offset = MSGID, addOffset = -10, limit = 20

        0 (disabled)

      • Optionallimit?: number

        Limits the number of messages to be retrieved.

        100
        
      • OptionalmaxId?: number

        Maximum message ID to return.

        Unless addOffset is used, this will work the same as offset.

        0 (disabled).

      • OptionalminId?: number

        Minimum message ID to return

        0 (disabled).

      • Optionaloffset?: GetHistoryOffset

        Offset for pagination

      • Optionalreverse?: boolean

        Whether to retrieve messages in reversed order (from older to recent), starting from offset (inclusive).

        Note: Using reverse=true requires you to pass offset from which to start fetching the messages "downwards". If you call getHistory with reverse=true and without any offset, it will return an empty array.

        false
        

    Returns Promise<ArrayPaginated<Message, GetHistoryOffset>>