Home > OS >  Telegram bot session not running
Telegram bot session not running

Time:06-21

please help. I'm trying to use bot.use(session()) in my telegram bot but I'm having trouble.

Whenever I use the following it crosses out the 'bot.use(Session())':

const {Telegraf,Scenes,Markup,session, Composer, Context} = require('telegraf');

Whenever I use the following, I get an error when I try to run my code:

const session= require('telegraf/session')

I get the following error:

 Error [ERR_PACKAGE_PATH_NOT_EXPORTED]: Package subpath './session' is not defined by "exports" in C:\Users\Simanye\TestUpdatebot\node_modules\telegraf\package.json
code: 'ERR_PACKAGE_PATH_NOT_EXPORTED'

Your response and assistance would be highly appreciated.

CodePudding user response:

I'm a beginner when it comes to node.js and telegraf but I'm learning through research and making mistakes. I hope this helps someone. It turns out that bot.use(session()) was just deprecated. I decided to use 'telegraf-mysql-session' for persistent sessions https://www.npmjs.com/package/telegraf-mysql-session. I'm also considering switching to grammy because it has better documentation. https://grammy.dev

  • Related