nestjs-telegraf
nestjs-telegraf copied to clipboard
Using global visibility handlers
Hi, I want to use some command and action handlers as global so that they work regardless of the user's current scene.
In my telegraph bot I implemented it like this.
export const globalCommands = new Composer<AppContext>();
globalCommands.command('start', startHandler);
globalCommands.command('exit', exitHandler);
bot.use((ctx, next) => {
const scenes: Map<string, BaseScene<AppContext>> = stages.scenes;
const scene = new SceneContextScene<AppContext, AppWizardSession>(
ctx,
scenes,
stages.options,
);
ctx.scene = scene;
return next();
});
bot.use(globalCommands);
bot.use(globalHandlers);
bot.use(stages.middleware());
How do I do this with nestjs-telegraf?
It would be great if we had a GlobalUpdate decorator that would be processed before the scenes
Any updates on this?