feat(decorators): TelegrafCashtag added

This commit is contained in:
Aleksandr Bukhalo
2020-03-19 17:16:48 +03:00
parent 68690da83e
commit 7d3e266f0f
5 changed files with 40 additions and 0 deletions

View File

@@ -82,6 +82,11 @@ export class TelegrafExplorer implements OnModuleInit {
instance[key],
);
this.handleTelegrafHashtag(instance, key, telegraf, metadata);
} else if (this.metadataAccessor.isTelegrafCashtag(instance[key])) {
const metadata = this.metadataAccessor.getTelegrafCashtagMetadata(
instance[key],
);
this.handleTelegrafCashtag(instance, key, telegraf, metadata);
}
},
);
@@ -187,4 +192,14 @@ export class TelegrafExplorer implements OnModuleInit {
// @ts-ignore
telegraf.hashtag(metadata.hashtag, instance[key].bind(instance));
}
handleTelegrafCashtag(
instance: object,
key: string,
telegraf: Telegraf<ContextMessageUpdate>,
metadata: any,
) {
// @ts-ignore
telegraf.cashtag(metadata.cashtag, instance[key].bind(instance));
}
}