diff --git a/sample/01-complete-app/src/app.module.ts b/sample/01-complete-app/src/app.module.ts index 408a307..6f7f595 100644 --- a/sample/01-complete-app/src/app.module.ts +++ b/sample/01-complete-app/src/app.module.ts @@ -9,7 +9,6 @@ import { GreeterBotName } from './app.constants'; imports: [ TelegrafModule.forRoot({ token: process.env.ECHO_BOT_TOKEN, - middlewares: [sessionMiddleware], include: [EchoModule], }), TelegrafModule.forRootAsync({ diff --git a/sample/common/decorators/from.decorator.ts b/sample/01-complete-app/src/common/decorators/from.decorator.ts similarity index 73% rename from sample/common/decorators/from.decorator.ts rename to sample/01-complete-app/src/common/decorators/from.decorator.ts index 5200f76..b02273c 100644 --- a/sample/common/decorators/from.decorator.ts +++ b/sample/01-complete-app/src/common/decorators/from.decorator.ts @@ -1,5 +1,5 @@ import { createParamDecorator, ExecutionContext } from '@nestjs/common'; -import { TelegrafExecutionContext } from '../../../lib/execution-context'; +import { TelegrafExecutionContext } from 'nestjs-telegraf'; export const From = createParamDecorator( (_, ctx: ExecutionContext) => diff --git a/sample/common/filters/telegraf-exception.filter.ts b/sample/01-complete-app/src/common/filters/telegraf-exception.filter.ts similarity index 80% rename from sample/common/filters/telegraf-exception.filter.ts rename to sample/01-complete-app/src/common/filters/telegraf-exception.filter.ts index 421ff84..a1a4099 100644 --- a/sample/common/filters/telegraf-exception.filter.ts +++ b/sample/01-complete-app/src/common/filters/telegraf-exception.filter.ts @@ -1,5 +1,5 @@ import { ArgumentsHost, Catch, ExceptionFilter } from '@nestjs/common'; -import { TelegrafArgumentsHost, TelegrafException } from '../../../lib'; +import { TelegrafArgumentsHost } from 'nestjs-telegraf'; @Catch() export class TelegrafExceptionFilter implements ExceptionFilter { diff --git a/sample/common/guards/admin.guard.ts b/sample/01-complete-app/src/common/guards/admin.guard.ts similarity index 77% rename from sample/common/guards/admin.guard.ts rename to sample/01-complete-app/src/common/guards/admin.guard.ts index 9cb9ab9..130dd4d 100644 --- a/sample/common/guards/admin.guard.ts +++ b/sample/01-complete-app/src/common/guards/admin.guard.ts @@ -1,7 +1,6 @@ import { CanActivate, ExecutionContext, Injectable } from '@nestjs/common'; -import { TelegrafExecutionContext } from '../../../lib/execution-context/telegraf-execution-context'; +import { TelegrafExecutionContext, TelegrafException } from 'nestjs-telegraf'; import { Context } from '../../interfaces/context.interface'; -import { TelegrafException } from '../../../lib/errors'; @Injectable() export class AdminGuard implements CanActivate { diff --git a/sample/common/interceptors/response-time.interceptor.ts b/sample/01-complete-app/src/common/interceptors/response-time.interceptor.ts similarity index 100% rename from sample/common/interceptors/response-time.interceptor.ts rename to sample/01-complete-app/src/common/interceptors/response-time.interceptor.ts diff --git a/sample/common/pipes/reverse-text.pipe.ts b/sample/01-complete-app/src/common/pipes/reverse-text.pipe.ts similarity index 100% rename from sample/common/pipes/reverse-text.pipe.ts rename to sample/01-complete-app/src/common/pipes/reverse-text.pipe.ts diff --git a/sample/01-complete-app/src/echo/echo.module.ts b/sample/01-complete-app/src/echo/echo.module.ts index 29c1bff..9c583a3 100644 --- a/sample/01-complete-app/src/echo/echo.module.ts +++ b/sample/01-complete-app/src/echo/echo.module.ts @@ -1,7 +1,7 @@ import { Module } from '@nestjs/common'; import { EchoUpdate } from './echo.update'; import { EchoService } from './echo.service'; -import { HelloScene } from './scenes/hello.scene'; +import { HelloScene } from '../greeter/scenes/hello.scene'; @Module({ providers: [EchoUpdate, EchoService, HelloScene], diff --git a/sample/01-complete-app/src/echo/echo.update.ts b/sample/01-complete-app/src/echo/echo.update.ts index fda0793..577809a 100644 --- a/sample/01-complete-app/src/echo/echo.update.ts +++ b/sample/01-complete-app/src/echo/echo.update.ts @@ -1,7 +1,7 @@ import { Telegraf } from 'telegraf'; -import { Command, Help, InjectBot, On, Start, Update } from 'nestjs-telegraf'; +import { Help, InjectBot, On, Start, Update } from 'nestjs-telegraf'; import { EchoService } from './echo.service'; -import { GreeterBotName, HELLO_SCENE_ID } from '../app.constants'; +import { GreeterBotName } from '../app.constants'; import { Context } from '../interfaces/context.interface'; @Update() @@ -23,11 +23,6 @@ export class EchoUpdate { await ctx.reply('Send me any text'); } - @Command('scene') - async onSceneCommand(ctx: Context): Promise { - await ctx.scene.enter(HELLO_SCENE_ID); - } - @On('message') async onMessage(ctx: Context): Promise { console.log('New message received'); diff --git a/sample/01-complete-app/src/greeter/greeter.update.ts b/sample/01-complete-app/src/greeter/greeter.update.ts index 424b3fb..a8424f7 100644 --- a/sample/01-complete-app/src/greeter/greeter.update.ts +++ b/sample/01-complete-app/src/greeter/greeter.update.ts @@ -1,5 +1,6 @@ -import { Hears, Start, Update } from 'nestjs-telegraf'; +import { Command, Hears, Start, Update } from 'nestjs-telegraf'; import { Context } from '../interfaces/context.interface'; +import { HELLO_SCENE_ID } from '../app.constants'; @Update() export class GreeterUpdate { @@ -13,4 +14,9 @@ export class GreeterUpdate { const { first_name } = ctx.from; await ctx.reply(`Hey ${first_name}`); } + + @Command('scene') + async onSceneCommand(ctx: Context): Promise { + await ctx.scene.enter(HELLO_SCENE_ID); + } } diff --git a/sample/01-complete-app/src/echo/scenes/hello.scene.ts b/sample/01-complete-app/src/greeter/scenes/hello.scene.ts similarity index 100% rename from sample/01-complete-app/src/echo/scenes/hello.scene.ts rename to sample/01-complete-app/src/greeter/scenes/hello.scene.ts