mirror of
https://github.com/Maks1mS/nestjs-telegraf.git
synced 2025-12-17 02:39:52 +03:00
feat(decorators): TelegrafEntity added
This commit is contained in:
@@ -62,6 +62,11 @@ export class TelegrafExplorer implements OnModuleInit {
|
||||
this.handleTelegrafHelp(instance, key, telegraf);
|
||||
} else if (this.metadataAccessor.isTelegrafSettings(instance[key])) {
|
||||
this.handleTelegrafSettings(instance, key, telegraf);
|
||||
} else if (this.metadataAccessor.isTelegrafEntity(instance[key])) {
|
||||
const metadata = this.metadataAccessor.getTelegrafEntityMetadata(
|
||||
instance[key],
|
||||
);
|
||||
this.handleTelegrafEntity(instance, key, telegraf, metadata);
|
||||
}
|
||||
},
|
||||
);
|
||||
@@ -127,4 +132,14 @@ export class TelegrafExplorer implements OnModuleInit {
|
||||
// @ts-ignore
|
||||
telegraf.settings(instance[key].bind(instance));
|
||||
}
|
||||
|
||||
handleTelegrafEntity(
|
||||
instance: object,
|
||||
key: string,
|
||||
telegraf: Telegraf<ContextMessageUpdate>,
|
||||
metadata: any,
|
||||
) {
|
||||
// @ts-ignore
|
||||
telegraf.entity(metadata.entity, instance[key].bind(instance));
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user