Ошибка Error: telegraf: Unsupported scene
throw new Error('telegraf: Unsupported scene');
^
Error: telegraf: Unsupported scene
Я совсем зелёный в джаваскрипте и создании ботов, не могу понять в чём моя ошибка
Файл со сценой:
const { Scenes } = require('telegraf');
class SceneGenerator {
productPriceScene() {
const productPrice = new Scenes.BaseScene('productPriceScene')
productPrice.enter(async (ctx) => {
await ctx.reply('?Введите цену товара')
})
productPrice.on('text', async (ctx) => {
if(!isNan(ctx.message.text)) {
var productPrice = ctx.message.text;
ctx.scene.enter('productNameScene')
} else {
await ctx.reply('❌Неверный ввод')
ctx.scene.reenter();
}
})
}
productNameScene() {
const productName = new Scenes.BaseScene('productNameScene')
productName.enter(async (ctx) => {
await ctx.reply('?Введите название товара')
})
productName.on('text', async (ctx) => {
var productName = ctx.message.text;
await ctx.reply(`Цена: ${productPrice}\n Название: ${productName}`)
ctx.scene.leave();
})
}
}
Инициализация сцены
const SceneGenerator = require('./Scenes')
const currScene = new SceneGenerator()
productPriceScene = currScene.productPriceScene()
productNameScene = currScene.productNameScene()
const stage = new Scenes.Stage([productPriceScene, productNameScene])
bot.use(session())
bot.use(stage.middleware())
Не нашёл никакой информации по этому поводу, надеюсь на вашу помощь