Answer the question
In order to leave comments, you need to log in
How to track exits from a scene in telegraf?
There is an external scene StartScene.
It starts the other two scenes Requests and Signin.
How to track the exit from these scenes in StartScene?
const bot = new Telegraf(CONFIG.BOT_TOKEN);
// Создаем сцены
const requests = createRequestsScene();
const signIn = createSignInScene();
const startScene = new BaseScene("StartScene");
const stage = new Stage([startScene, signIn, requests]);
// Настройка бота
bot.use(session());
bot.use(stage.middleware());
bot.use(async (ctx, next) => ctx.scene.enter("StartScene"));
startScene.enter(async (ctx) => {
// Проверка на доступ
await Helper.checkUser(ctx.message.from).then(async ({ isHaveAccess }) => {
if (isHaveAccess) {
ctx.scene.enter("Requests");
} else {
ctx.scene.enter("SignIn");
}
});
});
bot.launch().then(() => console.log("Bot started!"));
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question