Gathering detailed insights and metrics for telegraf-session-redis-upd
Gathering detailed insights and metrics for telegraf-session-redis-upd
Gathering detailed insights and metrics for telegraf-session-redis-upd
Gathering detailed insights and metrics for telegraf-session-redis-upd
npm install telegraf-session-redis-upd
Typescript
Module System
Min. Node Version
Node Version
NPM Version
JavaScript (100%)
Total Downloads
0
Last Day
0
Last Week
0
Last Month
0
Last Year
0
MIT License
50 Stars
87 Commits
25 Forks
1 Watchers
3 Branches
8 Contributors
Updated on May 27, 2025
Latest Version
5.1.4
Package Id
telegraf-session-redis-upd@5.1.4
Unpacked Size
8.39 kB
Size
3.25 kB
File Count
5
NPM Version
8.18.0
Node Version
16.17.0
Cumulative downloads
Total Downloads
Last Day
0%
NaN
Compared to previous day
Last Week
0%
NaN
Compared to previous week
Last Month
0%
NaN
Compared to previous month
Last Year
0%
NaN
Compared to previous year
3
1
Original: telegraf-session-redis
Updated for the new version of Telegraf
1$ npm install telegraf-session-redis-upd
1const Telegraf = require('telegraf') 2const RedisSession = require('telegraf-session-redis-upd') 3 4const bot = new Telegraf(process.env.BOT_TOKEN) 5 6const session = new RedisSession({ 7 store: { 8 host: process.env.TELEGRAM_SESSION_HOST || '127.0.0.1', 9 port: process.env.TELEGRAM_SESSION_PORT || 6379 10 } 11}) 12 13bot.use(session) 14 15bot.on('text', (ctx) => { 16 ctx.session.counter = ctx.session.counter || 0 17 ctx.session.counter++ 18 console.log('Session', ctx.session) 19}) 20 21bot.launch()
When you have stored the session key beforehand, you can access a session without having access to a context object. This is useful when you perform OAUTH or something similar, when a REDIRECT_URI is called on your bot server.
1const redisSession = new RedisSession() 2 3// Retrieve session state by session key 4redisSession.getSession(key) 5 .then((session) => { 6 console.log('Session state', session) 7 }) 8 9// Save session state 10redisSession.saveSession(key, session)
store
:
host
: Redis host (default: 127.0.0.1)port
: Redis port (default: 6379)path
: Unix socket stringurl
: Redis url...
: Other redis connection optionsproperty
: context property name (default: session
)ttl
: session ttl in seconds (default: forever)getSessionKey
: session key resolver function (ctx) => any
)Default implementation of getSessionKey
:
1function getSessionKey (ctx) { 2 if (!ctx.from || !ctx.chat) { 3 return 4 } 5 return `${ctx.from.id}:${ctx.chat.id}` 6}
To destroy a session simply set it to null
.
1bot.on('text', (ctx) => { 2 ctx.session = null 3}) 4
No vulnerabilities found.
Reason
no binaries found in the repo
Reason
0 existing vulnerabilities detected
Reason
license file detected
Details
Reason
project is archived
Details
Reason
Found 2/29 approved changesets -- score normalized to 0
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
security policy file not detected
Details
Reason
project is not fuzzed
Details
Reason
branch protection not enabled on development/release branches
Details
Reason
SAST tool is not run on all commits -- score normalized to 0
Details
Score
Last Scanned on 2025-07-07
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn More