mirror of
https://github.com/Maks1mS/nestjs-telegraf.git
synced 2025-09-23 09:49:06 +03:00
fix(sample-app): make possible to run app
This commit is contained in:
18
lib/utils/create-listener-decorator.util.ts
Normal file
18
lib/utils/create-listener-decorator.util.ts
Normal file
@@ -0,0 +1,18 @@
|
||||
import { SetMetadata } from '@nestjs/common';
|
||||
import { BaseScene as Scene } from 'telegraf';
|
||||
import { ComposerMethodArgs, SceneMethods } from '../types';
|
||||
import { UPDATE_LISTENER_METADATA } from '../telegraf.constants';
|
||||
import { ListenerMetadata } from '../interfaces';
|
||||
|
||||
export function createListenerDecorator<Method extends SceneMethods>(
|
||||
method: Method,
|
||||
) {
|
||||
return (
|
||||
...args: ComposerMethodArgs<Scene<never>, Method>
|
||||
): MethodDecorator => {
|
||||
return SetMetadata(UPDATE_LISTENER_METADATA, {
|
||||
method,
|
||||
args,
|
||||
} as ListenerMetadata);
|
||||
};
|
||||
}
|
Reference in New Issue
Block a user