mirror of
https://github.com/Maks1mS/nestjs-telegraf.git
synced 2025-09-23 17:59:06 +03:00
feat(): add sample app
This commit is contained in:
13
sample/app.module.ts
Normal file
13
sample/app.module.ts
Normal file
@@ -0,0 +1,13 @@
|
||||
import { Module } from '@nestjs/common';
|
||||
import { TelegrafModule } from '../lib';
|
||||
import { AppUpdate } from './app.update';
|
||||
|
||||
@Module({
|
||||
imports: [
|
||||
TelegrafModule.forRoot({
|
||||
token: '1467731595:AAHCvH65H9VQYKF9jE-E8c2rXsQBVAYseg8',
|
||||
}),
|
||||
],
|
||||
providers: [AppUpdate],
|
||||
})
|
||||
export class AppModule {}
|
9
sample/app.update.ts
Normal file
9
sample/app.update.ts
Normal file
@@ -0,0 +1,9 @@
|
||||
import { On, Update } from '../lib/decorators';
|
||||
|
||||
@Update()
|
||||
export class AppUpdate {
|
||||
@On('message')
|
||||
onMessage(): void {
|
||||
console.log('New message received');
|
||||
}
|
||||
}
|
7
sample/main.ts
Normal file
7
sample/main.ts
Normal file
@@ -0,0 +1,7 @@
|
||||
import { NestFactory } from '@nestjs/core';
|
||||
import { AppModule } from './app.module';
|
||||
|
||||
async function bootstrap() {
|
||||
await NestFactory.createApplicationContext(AppModule);
|
||||
}
|
||||
bootstrap();
|
Reference in New Issue
Block a user