Class: ChatManager

Parses raw chat API response data into structured Chat objects. Used internally by Bot.fetchChats().

Source: src/Types/Chat.js

Constructor

new ChatManager(chatData)
chatData
object — Raw API response from the chat endpoint.

Methods

parseChatData() method
parseChatData(): Object.<string, Chat>
Parse the raw chat data into a map of chatId → Chat instances. Extracts participants, last message info, and builds full Chat objects.
getChats() method
getChats(): Object.<string, Chat>
Returns the parsed chats object (empty until parseChatData() is called).
// Usually used internally by Bot:
const raw = await bot.fetchChatsRaw();
const manager = new ChatManager(raw);
const chats = manager.parseChatData();

// { "chat_id_1": Chat, "chat_id_2": Chat, ... }