1.0.2 • Published 2 years ago

telegraf-session-sequelize v1.0.2

Weekly downloads
-
License
ISC
Repository
github
Last release
2 years ago

Sequelize session middleware for Telegraf

Sequelize powered simple session middleware for Telegraf 4.0 with TypeScript support.

Installation

$ npm install telegraf-session-sequelize
$ yarn add telegraf-session-sequelize

Example

import { Telegraf } from 'telegraf'
import { Sequelize } from 'sequelize'
import { session } from 'telegraf-session-sequelize'

const bot = new Telegraf(process.env.BOT_TOKEN)

const init = async () => {
    const sequelize = await new Sequelize('dbName', 'username', 'pass', {
	    host: 'host',
	    dialect: 'postgres'
    })
	
    bot.use(session(sequelize, { collectionName: 'Sessions' }))
    bot.launch()
}

init()

API

Options