Closed Fazendaaa closed 6 years ago
@Fazendaaa default getSessionKey
implementation doesn't support inline_query
, but you can provide custom session key resolver, with any custom logic.
@dotcypress Would it be okay for you if I made a logic for it and write the tests when I was going to do the TypeScript typings PR?
@Fazendaaa the main idea to make this implementation optional(you can add more than 1 session per bot), and it must be implemented by library user. For example:
const session = new RedisSession({
store: {
host: process.env.TELEGRAM_SESSION_HOST || '127.0.0.1',
port: process.env.TELEGRAM_SESSION_PORT || 6379
},
// Session per user. In other words, session will be shared between chats
getSessionKey:(ctx) => ctx.from && `${ctx.from.id}`
})
Right now I'm trying to use it the session in my bot.on('inline_query')... Out of the box doesn't work, my Redis is open and running, telegraf-session-redis is connected to it and, the funny part is that on my bot.on('text') it works.
Init:
The problem:
outputs undefined
outputs { }
Is this a good description of the problem that I'm having? note: right now I've done the TypeScript typings, just hoping to fix that first before making a PR :)