Package Exports
- telegraf-session-sqlite
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (telegraf-session-sqlite) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
telegraf-session-sqlite
sqlite session middleware for telegraf framework
Install with npm/yarn
npm install telegraf-session-sqlite
yarn add telegraf-session-sqliteCreate table in your database
create table 'your_table_name'
(
id varchar(255)
primary key,
session varchar(255)
);Example:
const sqlite3 = require('sqlite3').verbose();
const db = new sqlite3.Database(PATH_TO_DATABASE);
const session = require('telegraf-session-sqlite');
const Telegraf = require('telegraf');
const bot = new Telegraf(process.env.BOT_TOKEN);
const options = {
db: db, //your sqlite3 instance
table_name: 'user_session', //database table name
}
bot.use(session(options))
...Options object description
| key | description | default |
|---|---|---|
| db | sqlite3 instance | none |
| table_name | database table name where session will be stored | 'telegraf_session' |