2020-12-25 23:57:17 +03:00
|
|
|
import { Type } from '@nestjs/common/interfaces/type.interface';
|
2020-12-25 23:11:16 +03:00
|
|
|
import { Composer, Telegraf } from 'telegraf';
|
|
|
|
import { Context } from './interfaces';
|
2020-12-23 21:35:40 +03:00
|
|
|
|
2020-12-25 23:57:17 +03:00
|
|
|
type CtxComposer = Composer<Context>;
|
|
|
|
|
|
|
|
type ComposerMethodFirstArg<T extends keyof CtxComposer> = Parameters<
|
|
|
|
CtxComposer[T]
|
2020-12-25 23:11:16 +03:00
|
|
|
>[0];
|
2020-12-25 23:57:17 +03:00
|
|
|
|
|
|
|
export type TelegrafActionTriggers = ComposerMethodFirstArg<'action'>;
|
|
|
|
export type TelegrafHearsTriggers = ComposerMethodFirstArg<'hears'>;
|
|
|
|
export type TelegrafInlineQueryTriggers = ComposerMethodFirstArg<'inlineQuery'>;
|
|
|
|
export type TelegrafEmail = ComposerMethodFirstArg<'email'>;
|
|
|
|
export type TelegrafUrl = ComposerMethodFirstArg<'url'>;
|
|
|
|
export type TelegrafTextLink = ComposerMethodFirstArg<'textLink'>;
|
|
|
|
export type TelegrafTextMention = ComposerMethodFirstArg<'textMention'>;
|
|
|
|
export type TelegrafCashtag = ComposerMethodFirstArg<'cashtag'>;
|
|
|
|
export type TelegrafHashtag = ComposerMethodFirstArg<'hashtag'>;
|
|
|
|
export type TelegrafCommand = ComposerMethodFirstArg<'command'>;
|
|
|
|
export type TelegrafMention = ComposerMethodFirstArg<'mention'>;
|
|
|
|
export type TelegrafPhone = ComposerMethodFirstArg<'phone'>;
|
|
|
|
export type TelegrafUpdateType = ComposerMethodFirstArg<'on'>;
|
|
|
|
|
|
|
|
export type TelegrafOption = ConstructorParameters<Type<Telegraf<Context>>>[1];
|
2020-12-25 23:11:16 +03:00
|
|
|
export type TelegrafLaunchOption = Parameters<Telegraf['launch']>[0];
|