mirror of
https://github.com/Maks1mS/nestjs-telegraf.git
synced 2025-09-23 09:49:06 +03:00
feat(wip): rework listener decorators
This commit is contained in:
@@ -1,19 +0,0 @@
|
||||
import { SetMetadata } from '@nestjs/common';
|
||||
import { DECORATORS } from '../telegraf.constants';
|
||||
import { HearsTriggers } from 'telegraf/typings/composer';
|
||||
import { Context } from '../interfaces';
|
||||
|
||||
export type TelegrafActionTriggers = HearsTriggers<Context>;
|
||||
|
||||
export interface ActionOptions {
|
||||
triggers: TelegrafActionTriggers;
|
||||
}
|
||||
|
||||
/**
|
||||
* Registers middleware for handling callback_data actions with regular expressions.
|
||||
*
|
||||
* @see https://telegraf.js.org/#/?id=action
|
||||
*/
|
||||
export const Action = (triggers: TelegrafActionTriggers): MethodDecorator => {
|
||||
return SetMetadata(DECORATORS.ACTION, { triggers });
|
||||
};
|
@@ -1,17 +0,0 @@
|
||||
import { SetMetadata } from '@nestjs/common';
|
||||
import { DECORATORS } from '../telegraf.constants';
|
||||
|
||||
export type TelegrafCashtagCashtag = string | string[];
|
||||
|
||||
export interface CashtagOptions {
|
||||
cashtag: TelegrafCashtagCashtag;
|
||||
}
|
||||
|
||||
/**
|
||||
* Cashtag handling.
|
||||
*
|
||||
* @see https://telegraf.js.org/#/?id=cashtag
|
||||
*/
|
||||
export const Cashtag = (cashtag: TelegrafCashtagCashtag): MethodDecorator => {
|
||||
return SetMetadata(DECORATORS.CASHTAG, { cashtag });
|
||||
};
|
@@ -1,17 +0,0 @@
|
||||
import { SetMetadata } from '@nestjs/common';
|
||||
import { DECORATORS } from '../telegraf.constants';
|
||||
|
||||
export type TelegrafCommandCommands = string | string[];
|
||||
|
||||
export interface CommandOptions {
|
||||
commands: TelegrafCommandCommands;
|
||||
}
|
||||
|
||||
/**
|
||||
* Command handling.
|
||||
*
|
||||
* @see https://telegraf.js.org/#/?id=command
|
||||
*/
|
||||
export const Command = (commands: TelegrafCommandCommands): MethodDecorator => {
|
||||
return SetMetadata(DECORATORS.COMMAND, { commands });
|
||||
};
|
@@ -1,8 +1,8 @@
|
||||
import { SetMetadata } from '@nestjs/common';
|
||||
import { DECORATORS } from '../telegraf.constants';
|
||||
import { TELEGRAF_UPDATE } from '../../telegraf.constants';
|
||||
|
||||
/**
|
||||
* `@Update` decorator, it's like NestJS `@Controller` decorator,
|
||||
* but for Telegram Bot API updates.
|
||||
*/
|
||||
export const Update = (): ClassDecorator => SetMetadata(DECORATORS.UPDATE, {});
|
||||
export const Update = (): ClassDecorator => SetMetadata(TELEGRAF_UPDATE, true);
|
@@ -1,22 +0,0 @@
|
||||
import { SetMetadata } from '@nestjs/common';
|
||||
import { DECORATORS } from '../telegraf.constants';
|
||||
|
||||
export type TelegrafEntityEntity =
|
||||
| string
|
||||
| string[]
|
||||
| RegExp
|
||||
| RegExp[]
|
||||
| Function;
|
||||
|
||||
export interface EntityOptions {
|
||||
entity: TelegrafEntityEntity;
|
||||
}
|
||||
|
||||
/**
|
||||
* Entity handling.
|
||||
*
|
||||
* @see https://telegraf.js.org/#/?id=entity
|
||||
*/
|
||||
export const Entity = (entity: TelegrafEntityEntity): MethodDecorator => {
|
||||
return SetMetadata(DECORATORS.ENTITY, { entity });
|
||||
};
|
@@ -1,17 +0,0 @@
|
||||
import { SetMetadata } from '@nestjs/common';
|
||||
import { DECORATORS } from '../telegraf.constants';
|
||||
|
||||
export type TelegrafHashtagHashtag = string | string[];
|
||||
|
||||
export interface HashtagOptions {
|
||||
hashtag: TelegrafHashtagHashtag;
|
||||
}
|
||||
|
||||
/**
|
||||
* Hashtag handling.
|
||||
*
|
||||
* @see https://telegraf.js.org/#/?id=hashtag
|
||||
*/
|
||||
export const Hashtag = (hashtag: TelegrafHashtagHashtag): MethodDecorator => {
|
||||
return SetMetadata(DECORATORS.HASHTAG, { hashtag });
|
||||
};
|
@@ -1,19 +0,0 @@
|
||||
import { SetMetadata } from '@nestjs/common';
|
||||
import { DECORATORS } from '../telegraf.constants';
|
||||
import { HearsTriggers } from 'telegraf/typings/composer';
|
||||
import { Context } from '../interfaces';
|
||||
|
||||
export type TelegrafHearsTriggers = HearsTriggers<Context>;
|
||||
|
||||
export interface HearsOptions {
|
||||
triggers: TelegrafHearsTriggers;
|
||||
}
|
||||
|
||||
/**
|
||||
* Registers middleware for handling text messages.
|
||||
*
|
||||
* @see https://telegraf.js.org/#/?id=hears
|
||||
*/
|
||||
export const Hears = (triggers: TelegrafHearsTriggers): MethodDecorator => {
|
||||
return SetMetadata(DECORATORS.HEARS, { triggers: triggers });
|
||||
};
|
@@ -1,11 +0,0 @@
|
||||
import { SetMetadata } from '@nestjs/common';
|
||||
import { DECORATORS } from '../telegraf.constants';
|
||||
|
||||
/**
|
||||
* Handler for /help command.
|
||||
*
|
||||
* @see https://telegraf.js.org/#/?id=help
|
||||
*/
|
||||
export const Help = (): MethodDecorator => {
|
||||
return SetMetadata(DECORATORS.HELP, {});
|
||||
};
|
@@ -1,28 +0,0 @@
|
||||
import { SetMetadata } from '@nestjs/common';
|
||||
import { DECORATORS } from '../telegraf.constants';
|
||||
import * as tt from 'telegraf/typings/telegram-types';
|
||||
|
||||
export type TelegrafInlineQueryTriggers = string | string[] | RegExp | RegExp[];
|
||||
|
||||
export interface InlineQueryOptions {
|
||||
triggers?: TelegrafInlineQueryTriggers;
|
||||
updateType:
|
||||
| tt.UpdateType
|
||||
| tt.UpdateType[]
|
||||
| tt.MessageSubTypes
|
||||
| tt.MessageSubTypes[];
|
||||
}
|
||||
|
||||
/**
|
||||
* Registers middleware for handling inline_query actions with regular expressions.
|
||||
*
|
||||
* @see https://telegraf.js.org/#/?id=inlinequery
|
||||
*/
|
||||
export const InlineQuery = (
|
||||
triggers?: TelegrafInlineQueryTriggers,
|
||||
): MethodDecorator => {
|
||||
return SetMetadata(DECORATORS.INLINE_QUERY, {
|
||||
triggers,
|
||||
updateType: 'inline_query',
|
||||
});
|
||||
};
|
25
lib/decorators/listeners/action.decorator.ts
Normal file
25
lib/decorators/listeners/action.decorator.ts
Normal file
@@ -0,0 +1,25 @@
|
||||
import { applyDecorators, SetMetadata } from '@nestjs/common';
|
||||
import {
|
||||
TELEGRAF_LISTENER_OPTIONS,
|
||||
TELEGRAF_LISTENER_TYPE,
|
||||
} from '../../telegraf.constants';
|
||||
import { TelegrafActionTriggers } from '../../telegraf.types';
|
||||
import { ListenerType } from '../../enums/listener-type.enum';
|
||||
|
||||
export interface ActionOptions {
|
||||
triggers: TelegrafActionTriggers;
|
||||
}
|
||||
|
||||
/**
|
||||
* Registers middleware for handling callback_data actions with regular expressions.
|
||||
*
|
||||
* @see https://telegraf.js.org/#/?id=action
|
||||
*/
|
||||
export const Action = (triggers: TelegrafActionTriggers): MethodDecorator => {
|
||||
return applyDecorators(
|
||||
SetMetadata(TELEGRAF_LISTENER_TYPE, ListenerType.Action),
|
||||
SetMetadata(TELEGRAF_LISTENER_OPTIONS, {
|
||||
triggers,
|
||||
} as ActionOptions),
|
||||
);
|
||||
};
|
25
lib/decorators/listeners/cashtag.decorator.ts
Normal file
25
lib/decorators/listeners/cashtag.decorator.ts
Normal file
@@ -0,0 +1,25 @@
|
||||
import { applyDecorators, SetMetadata } from '@nestjs/common';
|
||||
import {
|
||||
TELEGRAF_LISTENER_OPTIONS,
|
||||
TELEGRAF_LISTENER_TYPE,
|
||||
} from '../../telegraf.constants';
|
||||
import { TelegrafCashtag } from '../../telegraf.types';
|
||||
import { ListenerType } from '../../enums/listener-type.enum';
|
||||
|
||||
export interface CashtagOptions {
|
||||
cashtag: TelegrafCashtag;
|
||||
}
|
||||
|
||||
/**
|
||||
* Cashtag handling.
|
||||
*
|
||||
* @see https://telegraf.js.org/#/?id=cashtag
|
||||
*/
|
||||
export const Cashtag = (cashtag: TelegrafCashtag): MethodDecorator => {
|
||||
return applyDecorators(
|
||||
SetMetadata(TELEGRAF_LISTENER_TYPE, ListenerType.Cashtag),
|
||||
SetMetadata(TELEGRAF_LISTENER_OPTIONS, {
|
||||
cashtag,
|
||||
} as CashtagOptions),
|
||||
);
|
||||
};
|
25
lib/decorators/listeners/command.decorator.ts
Normal file
25
lib/decorators/listeners/command.decorator.ts
Normal file
@@ -0,0 +1,25 @@
|
||||
import { applyDecorators, SetMetadata } from '@nestjs/common';
|
||||
import {
|
||||
TELEGRAF_LISTENER_OPTIONS,
|
||||
TELEGRAF_LISTENER_TYPE,
|
||||
} from '../../telegraf.constants';
|
||||
import { ListenerType } from '../../enums/listener-type.enum';
|
||||
import { TelegrafCommand } from '../../telegraf.types';
|
||||
|
||||
export interface CommandOptions {
|
||||
commands: TelegrafCommand;
|
||||
}
|
||||
|
||||
/**
|
||||
* Command handling.
|
||||
*
|
||||
* @see https://telegraf.js.org/#/?id=command
|
||||
*/
|
||||
export const Command = (commands: TelegrafCommand): MethodDecorator => {
|
||||
return applyDecorators(
|
||||
SetMetadata(TELEGRAF_LISTENER_TYPE, ListenerType.Command),
|
||||
SetMetadata(TELEGRAF_LISTENER_OPTIONS, {
|
||||
commands,
|
||||
} as CommandOptions),
|
||||
);
|
||||
};
|
@@ -1,5 +1,6 @@
|
||||
import { SetMetadata } from '@nestjs/common';
|
||||
import { DECORATORS } from '../telegraf.constants';
|
||||
import { TELEGRAF_LISTENER_TYPE } from '../../telegraf.constants';
|
||||
import { ListenerType } from '../../enums/listener-type.enum';
|
||||
|
||||
/**
|
||||
* Registers middleware for handling callback_data actions with game query.
|
||||
@@ -7,5 +8,5 @@ import { DECORATORS } from '../telegraf.constants';
|
||||
* @see https://telegraf.js.org/#/?id=inlinequery
|
||||
*/
|
||||
export const GameQuery = (): MethodDecorator => {
|
||||
return SetMetadata(DECORATORS.GAME_QUERY, {});
|
||||
return SetMetadata(TELEGRAF_LISTENER_TYPE, ListenerType.GameQuery);
|
||||
};
|
25
lib/decorators/listeners/hashtag.decorator.ts
Normal file
25
lib/decorators/listeners/hashtag.decorator.ts
Normal file
@@ -0,0 +1,25 @@
|
||||
import { applyDecorators, SetMetadata } from '@nestjs/common';
|
||||
import {
|
||||
TELEGRAF_LISTENER_OPTIONS,
|
||||
TELEGRAF_LISTENER_TYPE,
|
||||
} from '../../telegraf.constants';
|
||||
import { ListenerType } from '../../enums/listener-type.enum';
|
||||
import { TelegrafHashtag } from '../../telegraf.types';
|
||||
|
||||
export interface HashtagOptions {
|
||||
hashtag: TelegrafHashtag;
|
||||
}
|
||||
|
||||
/**
|
||||
* Hashtag handling.
|
||||
*
|
||||
* @see https://telegraf.js.org/#/?id=hashtag
|
||||
*/
|
||||
export const Hashtag = (hashtag: TelegrafHashtag): MethodDecorator => {
|
||||
return applyDecorators(
|
||||
SetMetadata(TELEGRAF_LISTENER_TYPE, ListenerType.Hashtag),
|
||||
SetMetadata(TELEGRAF_LISTENER_OPTIONS, {
|
||||
hashtag,
|
||||
} as HashtagOptions),
|
||||
);
|
||||
};
|
25
lib/decorators/listeners/hears.decorator.ts
Normal file
25
lib/decorators/listeners/hears.decorator.ts
Normal file
@@ -0,0 +1,25 @@
|
||||
import { applyDecorators, SetMetadata } from '@nestjs/common';
|
||||
import {
|
||||
TELEGRAF_LISTENER_OPTIONS,
|
||||
TELEGRAF_LISTENER_TYPE,
|
||||
} from '../../telegraf.constants';
|
||||
import { ListenerType } from '../../enums/listener-type.enum';
|
||||
import { TelegrafHearsTriggers } from '../../telegraf.types';
|
||||
|
||||
export interface HearsOptions {
|
||||
triggers: TelegrafHearsTriggers;
|
||||
}
|
||||
|
||||
/**
|
||||
* Registers middleware for handling text messages.
|
||||
*
|
||||
* @see https://telegraf.js.org/#/?id=hears
|
||||
*/
|
||||
export const Hears = (triggers: TelegrafHearsTriggers): MethodDecorator => {
|
||||
return applyDecorators(
|
||||
SetMetadata(TELEGRAF_LISTENER_TYPE, ListenerType.Hears),
|
||||
SetMetadata(TELEGRAF_LISTENER_OPTIONS, {
|
||||
triggers,
|
||||
} as HearsOptions),
|
||||
);
|
||||
};
|
12
lib/decorators/listeners/help.decorator.ts
Normal file
12
lib/decorators/listeners/help.decorator.ts
Normal file
@@ -0,0 +1,12 @@
|
||||
import { SetMetadata } from '@nestjs/common';
|
||||
import { TELEGRAF_LISTENER_TYPE } from '../../telegraf.constants';
|
||||
import { ListenerType } from '../../enums/listener-type.enum';
|
||||
|
||||
/**
|
||||
* Handler for /help command.
|
||||
*
|
||||
* @see https://telegraf.js.org/#/?id=help
|
||||
*/
|
||||
export const Help = (): MethodDecorator => {
|
||||
return SetMetadata(TELEGRAF_LISTENER_TYPE, ListenerType.Help);
|
||||
};
|
27
lib/decorators/listeners/inline-query.decorator.ts
Normal file
27
lib/decorators/listeners/inline-query.decorator.ts
Normal file
@@ -0,0 +1,27 @@
|
||||
import { applyDecorators, SetMetadata } from '@nestjs/common';
|
||||
import {
|
||||
TELEGRAF_LISTENER_OPTIONS,
|
||||
TELEGRAF_LISTENER_TYPE,
|
||||
} from '../../telegraf.constants';
|
||||
import { ListenerType } from '../../enums/listener-type.enum';
|
||||
import { TelegrafInlineQueryTriggers } from '../../telegraf.types';
|
||||
|
||||
export interface InlineQueryOptions {
|
||||
triggers: TelegrafInlineQueryTriggers;
|
||||
}
|
||||
|
||||
/**
|
||||
* Registers middleware for handling inline_query actions with regular expressions.
|
||||
*
|
||||
* @see https://telegraf.js.org/#/?id=inlinequery
|
||||
*/
|
||||
export const InlineQuery = (
|
||||
triggers: TelegrafInlineQueryTriggers,
|
||||
): MethodDecorator => {
|
||||
return applyDecorators(
|
||||
SetMetadata(TELEGRAF_LISTENER_TYPE, ListenerType.InlineQuery),
|
||||
SetMetadata(TELEGRAF_LISTENER_OPTIONS, {
|
||||
triggers,
|
||||
} as InlineQueryOptions),
|
||||
);
|
||||
};
|
25
lib/decorators/listeners/mention.decorator.ts
Normal file
25
lib/decorators/listeners/mention.decorator.ts
Normal file
@@ -0,0 +1,25 @@
|
||||
import { applyDecorators, SetMetadata } from '@nestjs/common';
|
||||
import {
|
||||
TELEGRAF_LISTENER_OPTIONS,
|
||||
TELEGRAF_LISTENER_TYPE,
|
||||
} from '../../telegraf.constants';
|
||||
import { ListenerType } from '../../enums/listener-type.enum';
|
||||
import { TelegrafMention } from '../../telegraf.types';
|
||||
|
||||
export interface MentionOptions {
|
||||
mention: TelegrafMention;
|
||||
}
|
||||
|
||||
/**
|
||||
* Mention handling.
|
||||
*
|
||||
* @see https://telegraf.js.org/#/?id=mention
|
||||
*/
|
||||
export const Mention = (mention: TelegrafMention): MethodDecorator => {
|
||||
return applyDecorators(
|
||||
SetMetadata(TELEGRAF_LISTENER_TYPE, ListenerType.Mention),
|
||||
SetMetadata(TELEGRAF_LISTENER_OPTIONS, {
|
||||
mention,
|
||||
} as MentionOptions),
|
||||
);
|
||||
};
|
25
lib/decorators/listeners/on.decorator.ts
Normal file
25
lib/decorators/listeners/on.decorator.ts
Normal file
@@ -0,0 +1,25 @@
|
||||
import { applyDecorators, SetMetadata } from '@nestjs/common';
|
||||
import {
|
||||
TELEGRAF_LISTENER_OPTIONS,
|
||||
TELEGRAF_LISTENER_TYPE,
|
||||
} from '../../telegraf.constants';
|
||||
import { ListenerType } from '../../enums/listener-type.enum';
|
||||
import { TelegrafUpdateType } from '../../telegraf.types';
|
||||
|
||||
export interface OnOptions {
|
||||
updateTypes: TelegrafUpdateType;
|
||||
}
|
||||
|
||||
/**
|
||||
* Registers middleware for provided update type.
|
||||
*
|
||||
* @see https://telegraf.js.org/#/?id=on
|
||||
*/
|
||||
export const On = (updateTypes: TelegrafUpdateType): MethodDecorator => {
|
||||
return applyDecorators(
|
||||
SetMetadata(TELEGRAF_LISTENER_TYPE, ListenerType.On),
|
||||
SetMetadata(TELEGRAF_LISTENER_OPTIONS, {
|
||||
updateTypes,
|
||||
} as OnOptions),
|
||||
);
|
||||
};
|
25
lib/decorators/listeners/phone.decorator.ts
Normal file
25
lib/decorators/listeners/phone.decorator.ts
Normal file
@@ -0,0 +1,25 @@
|
||||
import { applyDecorators, SetMetadata } from '@nestjs/common';
|
||||
import {
|
||||
TELEGRAF_LISTENER_OPTIONS,
|
||||
TELEGRAF_LISTENER_TYPE,
|
||||
} from '../../telegraf.constants';
|
||||
import { ListenerType } from '../../enums/listener-type.enum';
|
||||
import { TelegrafPhone } from '../../telegraf.types';
|
||||
|
||||
export interface PhoneOptions {
|
||||
phone: TelegrafPhone;
|
||||
}
|
||||
|
||||
/**
|
||||
* Phone number handling.
|
||||
*
|
||||
* @see https://telegraf.js.org/#/?id=phone
|
||||
*/
|
||||
export const Phone = (phone: TelegrafPhone): MethodDecorator => {
|
||||
return applyDecorators(
|
||||
SetMetadata(TELEGRAF_LISTENER_TYPE, ListenerType.Phone),
|
||||
SetMetadata(TELEGRAF_LISTENER_OPTIONS, {
|
||||
phone,
|
||||
} as PhoneOptions),
|
||||
);
|
||||
};
|
12
lib/decorators/listeners/settings.decorator.ts
Normal file
12
lib/decorators/listeners/settings.decorator.ts
Normal file
@@ -0,0 +1,12 @@
|
||||
import { SetMetadata } from '@nestjs/common';
|
||||
import { TELEGRAF_LISTENER_TYPE } from '../../telegraf.constants';
|
||||
import { ListenerType } from '../../enums/listener-type.enum';
|
||||
|
||||
/**
|
||||
* Handler for /settings command.
|
||||
*
|
||||
* @see https://telegraf.js.org/#/?id=settings
|
||||
*/
|
||||
export const Settings = (): MethodDecorator => {
|
||||
return SetMetadata(TELEGRAF_LISTENER_TYPE, ListenerType.Settings);
|
||||
};
|
12
lib/decorators/listeners/start.decorator.ts
Normal file
12
lib/decorators/listeners/start.decorator.ts
Normal file
@@ -0,0 +1,12 @@
|
||||
import { SetMetadata } from '@nestjs/common';
|
||||
import { TELEGRAF_LISTENER_TYPE } from '../../telegraf.constants';
|
||||
import { ListenerType } from '../../enums/listener-type.enum';
|
||||
|
||||
/**
|
||||
* Handler for /start command.
|
||||
*
|
||||
* @see https://telegraf.js.org/#/?id=start
|
||||
*/
|
||||
export const Start = (): MethodDecorator => {
|
||||
return SetMetadata(TELEGRAF_LISTENER_TYPE, ListenerType.Start);
|
||||
};
|
12
lib/decorators/listeners/use.decorator.ts
Normal file
12
lib/decorators/listeners/use.decorator.ts
Normal file
@@ -0,0 +1,12 @@
|
||||
import { SetMetadata } from '@nestjs/common';
|
||||
import { TELEGRAF_LISTENER_TYPE } from '../../telegraf.constants';
|
||||
import { ListenerType } from '../../enums/listener-type.enum';
|
||||
|
||||
/**
|
||||
* Registers a middleware.
|
||||
*
|
||||
* @see https://telegraf.js.org/#/?id=use
|
||||
*/
|
||||
export const Use = (): MethodDecorator => {
|
||||
return SetMetadata(TELEGRAF_LISTENER_TYPE, ListenerType.Use);
|
||||
};
|
@@ -1,17 +0,0 @@
|
||||
import { SetMetadata } from '@nestjs/common';
|
||||
import { DECORATORS } from '../telegraf.constants';
|
||||
|
||||
export type TelegrafMentionUsername = string | string[];
|
||||
|
||||
export interface MentionOptions {
|
||||
username: TelegrafMentionUsername;
|
||||
}
|
||||
|
||||
/**
|
||||
* Mention handling.
|
||||
*
|
||||
* @see https://telegraf.js.org/#/?id=mention
|
||||
*/
|
||||
export const Mention = (username: TelegrafMentionUsername): MethodDecorator => {
|
||||
return SetMetadata(DECORATORS.MENTION, { username });
|
||||
};
|
@@ -1,22 +0,0 @@
|
||||
import { SetMetadata } from '@nestjs/common';
|
||||
import { DECORATORS } from '../telegraf.constants';
|
||||
import { UpdateType, MessageSubTypes } from 'telegraf/typings/telegram-types';
|
||||
|
||||
export type TelegrafOnUpdateTypes =
|
||||
| UpdateType
|
||||
| UpdateType[]
|
||||
| MessageSubTypes
|
||||
| MessageSubTypes[];
|
||||
|
||||
export interface OnOptions {
|
||||
updateTypes: TelegrafOnUpdateTypes;
|
||||
}
|
||||
|
||||
/**
|
||||
* Registers middleware for provided update type.
|
||||
*
|
||||
* @see https://telegraf.js.org/#/?id=on
|
||||
*/
|
||||
export const On = (updateTypes: TelegrafOnUpdateTypes): MethodDecorator => {
|
||||
return SetMetadata(DECORATORS.ON, { updateTypes: updateTypes });
|
||||
};
|
@@ -1,17 +0,0 @@
|
||||
import { SetMetadata } from '@nestjs/common';
|
||||
import { DECORATORS } from '../telegraf.constants';
|
||||
|
||||
export type TelegrafPhonePhone = string | string[];
|
||||
|
||||
export interface PhoneOptions {
|
||||
phone: TelegrafPhonePhone;
|
||||
}
|
||||
|
||||
/**
|
||||
* Phone number handling.
|
||||
*
|
||||
* @see https://telegraf.js.org/#/?id=phone
|
||||
*/
|
||||
export const Phone = (phone: TelegrafPhonePhone): MethodDecorator => {
|
||||
return SetMetadata(DECORATORS.PHONE, { phone });
|
||||
};
|
@@ -1,11 +0,0 @@
|
||||
import { SetMetadata } from '@nestjs/common';
|
||||
import { DECORATORS } from '../telegraf.constants';
|
||||
|
||||
/**
|
||||
* Handler for /settings command.
|
||||
*
|
||||
* @see https://telegraf.js.org/#/?id=settings
|
||||
*/
|
||||
export const Settings = (): MethodDecorator => {
|
||||
return SetMetadata(DECORATORS.SETTINGS, {});
|
||||
};
|
@@ -1,11 +0,0 @@
|
||||
import { SetMetadata } from '@nestjs/common';
|
||||
import { DECORATORS } from '../telegraf.constants';
|
||||
|
||||
/**
|
||||
* Handler for /start command.
|
||||
*
|
||||
* @see https://telegraf.js.org/#/?id=start
|
||||
*/
|
||||
export const Start = (): MethodDecorator => {
|
||||
return SetMetadata(DECORATORS.START, {});
|
||||
};
|
@@ -1,11 +0,0 @@
|
||||
import { SetMetadata } from '@nestjs/common';
|
||||
import { DECORATORS } from '../telegraf.constants';
|
||||
|
||||
/**
|
||||
* Registers a middleware.
|
||||
*
|
||||
* @see https://telegraf.js.org/#/?id=use
|
||||
*/
|
||||
export const Use = (): MethodDecorator => {
|
||||
return SetMetadata(DECORATORS.USE, {});
|
||||
};
|
Reference in New Issue
Block a user