fix(boot): update config interface

This commit is contained in:
Morb0 2021-01-02 15:47:17 +03:00
parent 13fe9b03c6
commit f88e34d489
2 changed files with 11 additions and 7 deletions

View File

@ -1,11 +1,18 @@
import { ModuleMetadata, Type } from '@nestjs/common/interfaces'; import { ModuleMetadata, Type } from '@nestjs/common/interfaces';
import { Middleware, Context } from 'telegraf'; import { Middleware, Context } from 'telegraf';
import { TelegrafLaunchOption, TelegrafOption } from '../telegraf.types'; import {
LaunchPollingOptions,
LaunchWebhookOptions,
TelegrafOptions,
} from 'telegraf/typings/telegraf';
export interface TelegrafModuleOptions<C extends Context = Context> { export interface TelegrafModuleOptions<C extends Context = Context> {
token: string; token: string;
options?: TelegrafOption; options?: TelegrafOptions;
launchOptions?: TelegrafLaunchOption; launchOptions?: {
polling?: LaunchPollingOptions;
webhook?: LaunchWebhookOptions;
};
middlewares?: Middleware<C>[]; middlewares?: Middleware<C>[];
} }

View File

@ -1,4 +1,4 @@
import { Composer, Middleware, BaseScene, Telegraf } from 'telegraf'; import { BaseScene, Composer, Middleware } from 'telegraf';
export type Filter<T extends any[], F> = T extends [] export type Filter<T extends any[], F> = T extends []
? [] ? []
@ -19,6 +19,3 @@ export type ComposerMethodArgs<
export type UpdateMethods = OnlyFunctionPropertyNames<Composer<never>>; export type UpdateMethods = OnlyFunctionPropertyNames<Composer<never>>;
export type SceneMethods = OnlyFunctionPropertyNames<BaseScene<never>>; export type SceneMethods = OnlyFunctionPropertyNames<BaseScene<never>>;
export type TelegrafOption = ConstructorParameters<typeof Telegraf>[1];
export type TelegrafLaunchOption = Parameters<Telegraf<never>['launch']>[0];