OptionaldeleteOptional method to delete chat data for a specific chat ID.
Telegram chat ID.
OptionaldeleteOptional method to delete conversation state.
Conversation key composite.
OptionaldeleteOptional method to delete user data for a specific user ID.
Telegram user ID.
OptionalflushOptional lifecycle hook to flush in-memory buffers to underlying disk or database.
Resolves when flushing completes.
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.
Retrieves 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.
Stores 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.
Contract for bot state persistence backends.
Enables storing and retrieving user data, chat data, bot data, conversation states, and scheduled background jobs across bot restarts.
Example