Y💜
Size: a a a
Y💜
JD
JD
1
this.options.username = botInfo.username
this.context.botInfo = botInfo
А это в контексте:get me () {
return this.options && this.options.username
}V
JD
V
const keyboardAgree = Markup.inlineKeyboard([{ text: 'Я согласен', callback_data: cnt.callbacks.agreement }]);
export const startScene = new Scenes.BaseScene<Scenes.SceneContext<SessionContextData>>(cnt.startSceneId);
startScene.enter(async ctx => {
console.log('---------- Enter', ctx.session.__scenes);
if (ctx.session.__scenes.userAgreement) {
return ctx.scene.leave();
}
return ctx.replyWithMarkdown(cnt.strings.startMessage, keyboardAgree);
});
startScene.action(cnt.callbacks.agreement, async ctx => {
console.log('---------- Action', ctx.session.__scenes);
ctx.session.__scenes.userAgreement = true;
return ctx.scene.leave();
});
startScene.leave(async ctx => {
console.log('---------- Leave', ctx.session.__scenes);
return ctx.reply(cnt.strings.welcome);
});JD
V
const stage = new Scenes.Stage([startScene]);
bot.use(stage.middleware());
bot.command('/info', ctx => ctx.scene.enter(cnt.startSceneId));
V
V
V
V
V
V
V
V
V
V