2021-01-06 17:55:40 +03:00
|
|
|
import { Command, Hears, Start, Update } from 'nestjs-telegraf';
|
2021-01-03 14:26:32 +03:00
|
|
|
import { Context } from '../interfaces/context.interface';
|
2021-01-06 17:55:40 +03:00
|
|
|
import { HELLO_SCENE_ID } from '../app.constants';
|
2021-01-03 14:26:32 +03:00
|
|
|
|
2021-01-03 16:21:25 +03:00
|
|
|
@Update()
|
2021-01-03 14:26:32 +03:00
|
|
|
export class GreeterUpdate {
|
2021-01-03 16:21:25 +03:00
|
|
|
@Start()
|
|
|
|
async onStart(ctx: Context): Promise<void> {
|
|
|
|
await ctx.reply('Say hello to me');
|
|
|
|
}
|
|
|
|
|
2021-01-03 14:26:32 +03:00
|
|
|
@Hears(['hi', 'hello', 'hey', 'qq'])
|
|
|
|
async onGreetings(ctx: Context): Promise<void> {
|
|
|
|
const { first_name } = ctx.from;
|
|
|
|
await ctx.reply(`Hey ${first_name}`);
|
|
|
|
}
|
2021-01-06 17:55:40 +03:00
|
|
|
|
|
|
|
@Command('scene')
|
|
|
|
async onSceneCommand(ctx: Context): Promise<void> {
|
|
|
|
await ctx.scene.enter(HELLO_SCENE_ID);
|
|
|
|
}
|
2021-01-03 14:26:32 +03:00
|
|
|
}
|