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