nestjs-telegraf/sample/01-complete-app/greeter/greeter.update.ts

17 lines
427 B
TypeScript
Raw Normal View History

import { Hears, Start, Update } from '../../lib';
2021-01-03 14:26:32 +03:00
import { Context } from '../interfaces/context.interface';
@Update()
2021-01-03 14:26:32 +03:00
export class GreeterUpdate {
@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}`);
}
}