SQLite session middleware for the Telegraf Telegram bot framework, version 1.0.6. Maintains session data persistently using SQLite3 database. Requires an existing sqlite3 instance and a table with a specific schema. Suitable for production bots that need state persistence across restarts with minimal dependencies. Compared to in-memory stores, this provides durability, but lacks built-in expiry or cleanup mechanisms.
npm install telegraf-session-sqliteNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Creates a Telegram bot with SQLite session middleware storing counter in memory session.
Ensure session objects are JSON-serializable. Avoid storing functions, Symbols, or circular structures.
Create the table manually using the provided SQL schema: CREATE TABLE telegraf_session (id VARCHAR(255) PRIMARY KEY, session VARCHAR(255));
Alter the table to use TEXT instead of VARCHAR(255) to store longer session strings.
Implement periodic cleanup of old sessions or use an alternative session store with TTL support.
Wrap bot usage in try-catch or attach error handlers to the database instance.
Run 'npm install telegraf-session-sqlite' and ensure the require path is correct.
Execute the CREATE TABLE statement from the README before calling session() middleware.
Use 'const session = require('telegraf-session-sqlite');' (commonjs) and verify the package is version 1.x.Ensure bot.use(session(options)) is called before any handlers that access ctx.session.