AbstractOptional method to delete chat data for a specific chat ID.
Telegram chat ID.
Optional method to delete conversation state.
Conversation key composite.
Protected AbstractdeleteOptional method to delete user data for a specific user ID.
Telegram user ID.
Retrieves global bot data.
Bot data object.
Retrieves stored chat data for a specific chat ID.
Telegram chat ID (number or string).
Chat data object (returns empty object if none found).
Retrieves all active conversation states.
A map of conversation keys to state values.
Retrieves all persisted scheduled jobs.
Array of PersistedJob definitions.
Protected AbstractgetRetrieves stored user data for a specific user ID.
Telegram user ID.
User data object (returns empty object if none found).
Stores global bot data.
Key-value map of global bot state.
Resolves when data is saved.
Stores chat data for a specific chat ID.
Telegram chat ID (number or string).
Key-value map of chat state.
Resolves when data is saved.
Overwrites the list of persisted scheduled jobs.
Array of PersistedJob definitions.
Resolves when jobs are saved.
Protected AbstractsetStores user data for a specific user ID.
Telegram user ID.
Key-value map of user state.
Resolves when data is saved.
Updates or saves the state for a specific conversation key.
Conversation key composite (e.g. chat_id + user_id).
Conversation state identifier or step number.
Resolves when state is updated.
Base abstract persistence class that handles common serialization and key-value mapping.
Extending this class allows writing new database drivers (PostgreSQL, Redis, MongoDB) with minimal boilerplate code.
Example