Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Wizard & Base Scenes #1995

Open
trongdth opened this issue Jun 2, 2024 Discussed in #1420 · 0 comments
Open

Wizard & Base Scenes #1995

trongdth opened this issue Jun 2, 2024 Discussed in #1420 · 0 comments

Comments

@trongdth
Copy link

trongdth commented Jun 2, 2024

Discussed in #1420

Originally posted by saymurrmeow March 31, 2021

context

version: Telegram 4.3.0


Hi, dudes!

How to use WizardScene and BaseScene together? In my case I have one BaseScene (that i want enter whenever I want) with main menu and WizardScene where user enters his data. Or maybe there is a way to solve the problem differently?

mainMenu.ts:

const mainMenuButtons = [
  [],
];

export const mainMenu = new Scenes.BaseScene<Scenes.SceneContext>('mainMenu');
mainMenu.enter((ctx) =>
  ctx.reply('Главное меню', Markup.keyboard(mainMenuButtons).resize())
);

orderScene.ts:

export const orderScene = new Scenes.WizardScene<Scenes.WizardContext>('ORDER_SCENE_ID' , async () => .....)

bot.ts

// troubles with generic
const bot = new Telegraf<Scenes.SceneContext>(config.BOT_API_TOKEN);

// here i try use scenes
const stage = new Scenes.Stage<Scenes.SceneContext>([mainMenu, orderScene ], {
  ttl: 10,
});

bot.use(session());
bot.use(stage.middleware());

bot.command('main', (ctx) => ctx.scene.enter('mainMenu'));
```</div>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant