Class: History
Defined in: structures/History.ts:9
In-memory, bounded message history observed while the client runs. Keeps up
to limit messages per chat and at most maxChats chats (least-recently
active chats are evicted). This is session history: messages seen via events
and messages you send, not a full server-side backfill.
Constructors
Constructor
new History(
limit,maxChats):History
Defined in: structures/History.ts:12
Parameters
limit
number
maxChats
number
Returns
History
Methods
add()
add(
message):void
Defined in: structures/History.ts:18
Records a message, de-duplicating by id.
Parameters
message
Returns
void
clear()
clear(
chatId?):void
Defined in: structures/History.ts:50
Clears history for one chat, or all chats if no id is given.
Parameters
chatId?
string
Returns
void
get()
get(
chatId):Message[]
Defined in: structures/History.ts:45
Recent messages for a chat (oldest first).
Parameters
chatId
string
Returns
Message[]