telegramsjs
    Preparing search index...

    Class UserManager

    Hierarchy (View Summary)

    Index

    Constructors

    Properties

    cache: Collection<string, User>
    cacheFilter?: (holds: User) => boolean
    cacheSize: number

    Accessors

    Methods

    • Adds or updates an entry in the cache.

      Parameters

      • data: User

        The data to be added or updated in the cache.

      • Optionalcache: boolean
      • Optionaloptions: { extras?: unknown[]; id?: string }

        Additional options.

      Returns User

      The cached or newly created entry.

    • Returns a new Iterator object that contains the [key, value] pairs for each element in the collection.

      Returns IterableIterator<[string, User]>

      An iterator object that can be used to iterate over the key-value pairs of the Collection.

    • Fetches a user by ID, optionally caching the result.

      Parameters

      • user: string | Message | ChatMember

        The ChatMember, Message, or user ID to fetch.

      • Optionaloptions: Omit<IFetchOptions, "fullInfo"> & { fullInfo?: false }

        Options for fetching.

      Returns Promise<User>

      The fetched User instance.

    • Fetches a user by ID, optionally caching the result.

      Parameters

      • user: string | Message | ChatMember

        The ChatMember, Message, or user ID to fetch.

      • Optionaloptions: Omit<IFetchOptions, "fullInfo"> & { fullInfo: true }

        Options for fetching.

      Returns Promise<ChatFullInfo>

      The fetched ChatFullInfo instance.

    • Fetches a user by ID, optionally caching the result.

      Parameters

      Returns Promise<ChatFullInfo | User>

      The fetched User or ChatFullInfo instance.

    • Fetches multiple users at once.

      Parameters

      • users: UserResolvable[]

        Array of users to fetch.

      • Optionaloptions: Omit<IFetchOptions, "fullInfo"> & { fullInfo?: false }

        Options for fetching.

      Returns Promise<(User | null)[]>

      Array of fetched users (nulls for failed fetches).

    • Fetches multiple users at once.

      Parameters

      • users: UserResolvable[]

        Array of users to fetch.

      • Optionaloptions: Omit<IFetchOptions, "fullInfo"> & { fullInfo: true }

        Options for fetching.

      Returns Promise<(ChatFullInfo | null)[]>

      Array of fetched users (nulls for failed fetches).

    • Fetches multiple users at once.

      Parameters

      Returns Promise<(ChatFullInfo | User | null)[]>

      Array of fetched users (nulls for failed fetches).

    • Removes an entry from the cache.

      Parameters

      • id: string

        The ID of the entry to remove.

      Returns boolean

      Whether the entry was successfully removed.

    • Resolves a user from a ChatMember, Message, User or user ID.

      Parameters

      • user: UserResolvable

        The ChatMember, Message, User or user ID to resolve.

      Returns User | null

      The resolved User instance or null if not found.

    • Resolves the user ID from a ChatMember, Message, User or user ID.

      Parameters

      • user: any

        The ChatMember, Message, User or user ID to resolve.

      Returns string | null

      The resolved user ID or null if not found.