Class UserManager

Hierarchy (view full)

Constructors

Properties

Accessors

Methods

Constructors

Properties

cache: Collection<string, User>
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
    • 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: {
          cache?: boolean;
          force?: boolean;
      }

      Options for fetching.

      • Optionalcache?: boolean
      • Optionalforce?: boolean

    Returns Promise<User>

    The fetched User 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 the user ID from a ChatMember, Message, or user ID.

    Parameters

    Returns null | string

    The resolved user ID or null if not found.