Class UserManager

Hierarchy (view full)

Constructors

Properties

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

Accessors

Methods

  • 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.

  • Adds or updates an entry in the cache.

    Parameters

    • data: User

      The data to be added or updated in the cache.

    • Optionalcache: boolean
    • Optional__namedParameters: {
          extras?: unknown[];
          id?: string;
      }
      • Optionalextras?: unknown[]
      • Optionalid?: string

    Returns User

    The cached or newly created entry.

  • 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.

  • 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, or user ID.

    Parameters

    Returns null | User

    The resolved User instance or null if not found.

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

    Parameters

    Returns null | string

    The resolved user ID or null if not found.