2021-01-03 14:26:32 +03:00
|
|
|
import { HELLO_SCENE_ID } from '../../app.constants';
|
|
|
|
import { Context } from '../../interfaces/context.interface';
|
2021-01-03 16:40:08 +03:00
|
|
|
import { Scene, SceneEnter, SceneLeave, Command } from '../../../../lib';
|
2020-12-29 22:41:06 +03:00
|
|
|
|
|
|
|
@Scene(HELLO_SCENE_ID)
|
|
|
|
export class HelloScene {
|
|
|
|
@SceneEnter()
|
|
|
|
async onSceneEnter(ctx: Context): Promise<void> {
|
|
|
|
console.log('Enter to scene');
|
|
|
|
await ctx.reply('Welcome on scene ✋');
|
|
|
|
}
|
|
|
|
|
|
|
|
@SceneLeave()
|
2020-12-30 01:49:09 +03:00
|
|
|
async onSceneLeave(ctx: Context): Promise<void> {
|
2020-12-29 22:41:06 +03:00
|
|
|
console.log('Leave from scene');
|
|
|
|
await ctx.reply('Bye Bye 👋');
|
|
|
|
}
|
|
|
|
|
|
|
|
@Command('hello')
|
|
|
|
async onHelloCommand(ctx: Context): Promise<void> {
|
|
|
|
console.log('Use say hello');
|
|
|
|
await ctx.reply('Hi');
|
|
|
|
}
|
|
|
|
|
|
|
|
@Command('leave')
|
|
|
|
async onLeaveCommand(ctx: Context): Promise<void> {
|
|
|
|
await ctx.scene.leave();
|
|
|
|
}
|
|
|
|
}
|