我正在使用node.js telegraf模块创建一个电报机器人。
我正在使用下面的代码。
var picture = (context)ctx.message.photo[0].file_id;
var photo = `https://api.telegram.org/bot1234-ABCD/getFile?file_id=${picture}`;
console.log(photo.file_path);
Run Code Online (Sandbox Code Playgroud) 我使用创建一个电报机器人telegraf使用向导。我想在我的机器人中有几个向导。如何进入另一个场景?我正在使用以下代码,但出现错误Cannot read property 'enter' of undefined。
const Stage = require("telegraf/stage");
const WizardScene = require("telegraf/scenes/wizard");
const wiz1 = new WizardScene('task1',
ctx => {...},
ctx => {...}
);
const wiz2 = new WizardScene('task2',
ctx => {...},
ctx => {...}
);
const wiz3 = new WizardScene('task3',
ctx => {...},
ctx => {...}
);
const stage =new Stage([wiz1,wiz2,wiz3],{default: 'task1'})
bot.hears('anAction', (ctx) => {Stage.enter('wiz2')}); // this does not work
Run Code Online (Sandbox Code Playgroud)