电报机器人会话不运行
请帮忙。我正在尝试在电报机器人中使用bot.use(session()),但我遇到了麻烦。
每当我使用以下内容时,它都会划出'bot.use(session())':
const {Telegraf,Scenes,Markup,session, Composer, Context} = require('telegraf');
每当我使用以下内容时,我都会尝试运行代码时会出现错误:
const session= require('telegraf/session')
我会收到以下错误:
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'
您的回应和帮助将不胜感激。
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.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
在Node.js和Telegraf方面,我是初学者,但我正在通过研究和犯错误学习。我希望这对某人有帮助。事实证明,bot.use(session())刚刚被弃用。我决定使用'telegraf-mysql-session'进行持续会话 https> https:https:// wwww。 npmjs.com/package/telegraf-mysql-session 。我还考虑切换到格莱美,因为它具有更好的文档。 https://grammy.dev
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