fix(sample): remove relation path import

This commit is contained in:
Morb0 2021-01-06 17:55:40 +03:00
parent c32f2c72d9
commit 31008b04c9
10 changed files with 13 additions and 14 deletions

View File

@ -9,7 +9,6 @@ import { GreeterBotName } from './app.constants';
imports: [ imports: [
TelegrafModule.forRoot({ TelegrafModule.forRoot({
token: process.env.ECHO_BOT_TOKEN, token: process.env.ECHO_BOT_TOKEN,
middlewares: [sessionMiddleware],
include: [EchoModule], include: [EchoModule],
}), }),
TelegrafModule.forRootAsync({ TelegrafModule.forRootAsync({

View File

@ -1,5 +1,5 @@
import { createParamDecorator, ExecutionContext } from '@nestjs/common'; import { createParamDecorator, ExecutionContext } from '@nestjs/common';
import { TelegrafExecutionContext } from '../../../lib/execution-context'; import { TelegrafExecutionContext } from 'nestjs-telegraf';
export const From = createParamDecorator( export const From = createParamDecorator(
(_, ctx: ExecutionContext) => (_, ctx: ExecutionContext) =>

View File

@ -1,5 +1,5 @@
import { ArgumentsHost, Catch, ExceptionFilter } from '@nestjs/common'; import { ArgumentsHost, Catch, ExceptionFilter } from '@nestjs/common';
import { TelegrafArgumentsHost, TelegrafException } from '../../../lib'; import { TelegrafArgumentsHost } from 'nestjs-telegraf';
@Catch() @Catch()
export class TelegrafExceptionFilter<T> implements ExceptionFilter { export class TelegrafExceptionFilter<T> implements ExceptionFilter {

View File

@ -1,7 +1,6 @@
import { CanActivate, ExecutionContext, Injectable } from '@nestjs/common'; 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 { Context } from '../../interfaces/context.interface';
import { TelegrafException } from '../../../lib/errors';
@Injectable() @Injectable()
export class AdminGuard implements CanActivate { export class AdminGuard implements CanActivate {

View File

@ -1,7 +1,7 @@
import { Module } from '@nestjs/common'; import { Module } from '@nestjs/common';
import { EchoUpdate } from './echo.update'; import { EchoUpdate } from './echo.update';
import { EchoService } from './echo.service'; import { EchoService } from './echo.service';
import { HelloScene } from './scenes/hello.scene'; import { HelloScene } from '../greeter/scenes/hello.scene';
@Module({ @Module({
providers: [EchoUpdate, EchoService, HelloScene], providers: [EchoUpdate, EchoService, HelloScene],

View File

@ -1,7 +1,7 @@
import { Telegraf } from 'telegraf'; 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 { EchoService } from './echo.service';
import { GreeterBotName, HELLO_SCENE_ID } from '../app.constants'; import { GreeterBotName } from '../app.constants';
import { Context } from '../interfaces/context.interface'; import { Context } from '../interfaces/context.interface';
@Update() @Update()
@ -23,11 +23,6 @@ export class EchoUpdate {
await ctx.reply('Send me any text'); await ctx.reply('Send me any text');
} }
@Command('scene')
async onSceneCommand(ctx: Context): Promise<void> {
await ctx.scene.enter(HELLO_SCENE_ID);
}
@On('message') @On('message')
async onMessage(ctx: Context): Promise<void> { async onMessage(ctx: Context): Promise<void> {
console.log('New message received'); console.log('New message received');

View File

@ -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 { Context } from '../interfaces/context.interface';
import { HELLO_SCENE_ID } from '../app.constants';
@Update() @Update()
export class GreeterUpdate { export class GreeterUpdate {
@ -13,4 +14,9 @@ export class GreeterUpdate {
const { first_name } = ctx.from; const { first_name } = ctx.from;
await ctx.reply(`Hey ${first_name}`); await ctx.reply(`Hey ${first_name}`);
} }
@Command('scene')
async onSceneCommand(ctx: Context): Promise<void> {
await ctx.scene.enter(HELLO_SCENE_ID);
}
} }