Class ChatManager

Hierarchy (view full)

Constructors

Properties

cache: Collection<string, Chat>
cacheFilter?: ((holds: Chat) => 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, Chat]>

    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: Chat

      The data to be added or updated in the cache.

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

    Returns Chat

    The cached or newly created entry.

  • Fetches a chat object from the API.

    Parameters

    • user: string | Chat
    • Optionaloptions: Omit<IFetchOptions, "fullInfo"> & {
          fullInfo?: false;
      }

      Additional options.

    Returns Promise<Chat>

    The fetched chat object.

  • Fetches a chat object from the API.

    Parameters

    • user: string | Chat
    • Optionaloptions: Omit<IFetchOptions, "fullInfo"> & {
          fullInfo: true;
      }

      Additional options.

    Returns Promise<ChatFullInfo>

    The fetched ChatFullInfo object.

  • Fetches a chat object from the API.

    Parameters

    Returns Promise<ChatFullInfo | Chat>

    The fetched chat or full chat info object.

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

    Parameters

    • chat:
          | string
          | Message
          | ChatMember
          | Chat

      The chat instance, chat member, message, or ID.

    Returns null | Chat

    • The resolved chat object or null if not found.
  • Resolves the ID of an entry from the cache.

    Parameters

    • idOrInstance: any

      The ID or instance to resolve.

    Returns null | string

    The resolved ID or null if not found.