fix(): module work restored

This commit is contained in:
Alexander Bukhalo 2021-01-02 16:37:59 +03:00
parent 2df4ddfee4
commit 63fe457b58
3 changed files with 6 additions and 4 deletions

View File

@ -5,7 +5,7 @@ import { UPDATE_LISTENER_METADATA } from '../telegraf.constants';
import { ListenerMetadata } from '../interfaces';
export function createUpdateListenerDecorator<Method extends UpdateMethods>(
method: Method,
method: unknown,
) {
return (
...args: ComposerMethodArgs<Composer<never>, Method>

View File

@ -7,7 +7,9 @@ export const TelegrafProvider = {
provide: Telegraf,
useFactory: (options: TelegrafModuleOptions) => {
const telegraf = new Telegraf(options.token, options.options);
telegraf.use(...options.middlewares);
if (options.middlewares?.length > 0) {
telegraf.use(...options.middlewares);
}
return telegraf;
},
inject: [TELEGRAF_MODULE_OPTIONS],

View File

@ -1,4 +1,4 @@
import { SceneContext, Telegraf } from 'telegraf';
import { Telegraf } from 'telegraf';
import { Command, Help, InjectBot, On, Start, Update } from '../lib';
import { EchoService } from './echo.service';
import { HELLO_SCENE_ID } from './app.constants';
@ -8,7 +8,7 @@ import { Context } from './interfaces/context.interface';
export class AppUpdate {
constructor(
@InjectBot()
private readonly bot: Telegraf<SceneContext>,
private readonly bot: Telegraf<any>, // TODO: fix any
private readonly echoService: EchoService,
) {}