Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/ejnshtein/telegraf-session
https://github.com/ejnshtein/telegraf-session
Last synced: 3 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/ejnshtein/telegraf-session
- Owner: ejnshtein
- License: mit
- Created: 2020-02-06T16:35:00.000Z (almost 5 years ago)
- Default Branch: master
- Last Pushed: 2020-02-06T16:54:21.000Z (almost 5 years ago)
- Last Synced: 2023-03-01T04:36:31.075Z (almost 2 years ago)
- Language: JavaScript
- Size: 2.93 KB
- Stars: 2
- Watchers: 1
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: readme.md
- License: LICENSE
Awesome Lists containing this project
README
# @telegraf/session
[![node](https://img.shields.io/npm/v/@telegraf/session.svg?style=flat-square)](https://www.npmjs.com/package/@telegraf/session)
This is session middleware for [@telegraf/core](https://npmjs.com/package/@telegraf/core) package.
*Currently in development progress*
## Installation
```
$ npm install @telegraf/session
```
or using `yarn`:
```
$ yarn add @telegraf/session
```## Usage
```js
import Telegraf from '@telegraf/core'
import session from '@telegraf/session'const bot = new Telegraf('token')
bot.use(session())
bot.on('text', (ctx) => {
ctx.session.counter = ctx.session.counter || 0
ctx.session.counter++
return ctx.reply(`Message counter:${ctx.session.counter}`)
})bot.launch()
```_Coming soon..._