feat(decorators): TelegrafHashtag added

This commit is contained in:
Aleksandr Bukhalo
2020-03-19 17:14:34 +03:00
parent 225c931dbb
commit 68690da83e
5 changed files with 40 additions and 0 deletions

View File

@@ -77,6 +77,11 @@ export class TelegrafExplorer implements OnModuleInit {
instance[key],
);
this.handleTelegrafPhone(instance, key, telegraf, metadata);
} else if (this.metadataAccessor.isTelegrafHashtag(instance[key])) {
const metadata = this.metadataAccessor.getTelegrafHashtagMetadata(
instance[key],
);
this.handleTelegrafHashtag(instance, key, telegraf, metadata);
}
},
);
@@ -172,4 +177,14 @@ export class TelegrafExplorer implements OnModuleInit {
// @ts-ignore
telegraf.phone(metadata.phone, instance[key].bind(instance));
}
handleTelegrafHashtag(
instance: object,
key: string,
telegraf: Telegraf<ContextMessageUpdate>,
metadata: any,
) {
// @ts-ignore
telegraf.hashtag(metadata.hashtag, instance[key].bind(instance));
}
}