2020-12-25 23:11:16 +03:00
|
|
|
import { Injectable } from '@nestjs/common';
|
2020-03-19 16:21:35 +03:00
|
|
|
import { Reflector } from '@nestjs/core';
|
2020-03-19 18:20:07 +03:00
|
|
|
import {
|
2020-12-25 23:11:16 +03:00
|
|
|
TELEGRAF_LISTENER_TYPE,
|
|
|
|
TELEGRAF_MODULE_OPTIONS,
|
|
|
|
} from './telegraf.constants';
|
|
|
|
import { ListenerType } from './enums/listener-type.enum';
|
2020-03-19 16:21:35 +03:00
|
|
|
|
|
|
|
@Injectable()
|
|
|
|
export class TelegrafMetadataAccessor {
|
|
|
|
constructor(private readonly reflector: Reflector) {}
|
|
|
|
|
2020-12-25 23:11:16 +03:00
|
|
|
getListenerType(target: Function): ListenerType | undefined {
|
|
|
|
return this.reflector.get<ListenerType>(TELEGRAF_LISTENER_TYPE, target);
|
2020-09-09 22:46:25 +03:00
|
|
|
}
|
|
|
|
|
2020-12-25 23:11:16 +03:00
|
|
|
getListenerOptions<T>(target: Function): unknown | undefined {
|
|
|
|
return this.reflector.get<unknown>(TELEGRAF_MODULE_OPTIONS, target);
|
2020-03-19 17:28:56 +03:00
|
|
|
}
|
2020-03-19 16:21:35 +03:00
|
|
|
}
|