Skip to main content

Interface: StateStore

Defined in: state/StateStore.ts:6

Pluggable per-chat state store. The default is an in-memory MemoryStore; implement this interface to back conversation state with Redis, a database, etc. State is stored as one plain object per chat JID.

Methods

delete()

delete(chatId): void | Promise<void>

Defined in: state/StateStore.ts:12

Removes all state for a chat.

Parameters

chatId

string

Returns

void | Promise<void>


get()

get(chatId): Record<string, unknown> | Promise<Record<string, unknown>>

Defined in: state/StateStore.ts:8

Returns the full state object for a chat (empty object if none).

Parameters

chatId

string

Returns

Record<string, unknown> | Promise<Record<string, unknown>>


set()

set(chatId, state): void | Promise<void>

Defined in: state/StateStore.ts:10

Replaces the full state object for a chat.

Parameters

chatId

string

state

Record<string, unknown>

Returns

void | Promise<void>