feat(decorators): TelegrafPhone added

This commit is contained in:
Aleksandr Bukhalo
2020-03-19 17:02:37 +03:00
parent f5d9cf13b6
commit 225c931dbb
5 changed files with 42 additions and 0 deletions

View File

@@ -72,6 +72,11 @@ export class TelegrafExplorer implements OnModuleInit {
instance[key],
);
this.handleTelegrafMention(instance, key, telegraf, metadata);
} else if (this.metadataAccessor.isTelegrafPhone(instance[key])) {
const metadata = this.metadataAccessor.getTelegrafPhoneMetadata(
instance[key],
);
this.handleTelegrafPhone(instance, key, telegraf, metadata);
}
},
);
@@ -157,4 +162,14 @@ export class TelegrafExplorer implements OnModuleInit {
// @ts-ignore
telegraf.mention(metadata.username, instance[key].bind(instance));
}
handleTelegrafPhone(
instance: object,
key: string,
telegraf: Telegraf<ContextMessageUpdate>,
metadata: any,
) {
// @ts-ignore
telegraf.phone(metadata.phone, instance[key].bind(instance));
}
}