podvarkov/telegraf-session-sqlite — reverse-engineered prompt
Reverse engineered prompt
Build me a small JavaScript library that lets a Telegraf Telegram bot store user session data in a SQLite database.
I want it to work as middleware, so someone can create a sqlite3 database connection, pass it into the library with an options object, and then use it with bot.use. It should save and load the session for each chat or user from a database table. The options should support the database instance and an optional table name, with a sensible default table name if none is provided.
Please include the main package code, a simple helper if needed, package setup, and a clear README showing how to install it, how to create the SQLite table with id and session columns, and a short Telegraf bot example. Keep it simple and focused, no extra bot features. Look up the current Telegraf and sqlite3 docs online if you need to.
Want more depth? Deep Reverse