Listeners
NestGram supports interacting with all telegram events via the @On
decorator.
src/app.service.ts
import {Injectable, Logger} from '@nestjs/common';
import {On, Context, ContextOf} from '@nestgramjs/core';
@Injectable()
export class AppService {
private readonly logger = new Logger(AppService.name);
@On('message')
async onMessage(@Context() [ctx]: ContextOf<'message'>) {
this.logger.log(ctx);
}
}