• Iterate over dialogs.

    Note that due to Telegram API limitations, ordering here can only be anti-chronological (i.e. newest - first), and draft update date is not considered when sorting.

    Parameters

    • client: ITelegramClient
    • Optionalparams: {
          archived?: "exclude" | "only" | "keep";
          chunkSize?: number;
          filter?: Partial<Omit<RawDialogFilter, "_" | "id" | "title">>;
          folder?: InputDialogFolder;
          limit?: number;
          offsetDate?: number | Date;
          offsetId?: number;
          offsetPeer?: TypeInputPeer;
          pinned?:
              | "include"
              | "exclude"
              | "only"
              | "keep";
      }

      Fetch parameters

      • Optionalarchived?: "exclude" | "only" | "keep"

        How to handle archived chats?

        Whether to keep them among other dialogs, exclude them from the list, or only return archived dialogs

        Ignored for folders, since folders themselves contain information about archived chats.

        Note: when pinned=only, archived=keep will act as only because of Telegram API limitations.

        exclude

      • OptionalchunkSize?: number

        Chunk size which will be passed to messages.getDialogs. You shouldn't usually care about this.

        100.
        
      • Optionalfilter?: Partial<Omit<RawDialogFilter, "_" | "id" | "title">>

        Additional filtering for the dialogs.

        If folder is not provided, this filter is used instead. If folder is provided, fields from this object are used to override filters inside the folder.

      • Optionalfolder?: InputDialogFolder

        Folder from which the dialogs will be fetched.

        You can pass folder object, id or title

        Note that passing anything except object will cause the list of the folders to be fetched, and passing a title may fetch from a wrong folder if you have multiple with the same title.

        Also note that fetching dialogs in a folder is orders of magnitudes* slower than normal because of Telegram API limitations - we have to fetch all dialogs and filter the ones we need manually. If possible, use Dialog.filterFolder instead.

        When a folder with given ID or title is not found, MtArgumentError is thrown

        <empty> (fetches from "All" folder)
        
      • Optionallimit?: number

        Limits the number of dialogs to be received.

        Infinity, i.e. all dialogs are fetched

      • OptionaloffsetDate?: number | Date

        Offset message date used as an anchor for pagination.

      • OptionaloffsetId?: number

        Offset message ID used as an anchor for pagination

      • OptionaloffsetPeer?: TypeInputPeer

        Offset peer used as an anchor for pagination

      • Optionalpinned?:
            | "include"
            | "exclude"
            | "only"
            | "keep"

        How to handle pinned dialogs?

        Whether to include them at the start of the list, exclude them at all, or only return pinned dialogs.

        Additionally, for folders you can specify keep, which will return pinned dialogs ordered by date among other non-pinned dialogs.

        Note: When using include mode with folders, pinned dialogs will only be fetched if all offset parameters are unset.

        include.

    Returns AsyncIterableIterator<Dialog>