mirror of
https://github.com/Maks1mS/nestjs-telegraf.git
synced 2025-12-17 02:39:52 +03:00
feat(decorators): TelegrafAction added
This commit is contained in:
@@ -87,6 +87,11 @@ export class TelegrafExplorer implements OnModuleInit {
|
||||
instance[key],
|
||||
);
|
||||
this.handleTelegrafCashtag(instance, key, telegraf, metadata);
|
||||
} else if (this.metadataAccessor.isTelegrafAction(instance[key])) {
|
||||
const metadata = this.metadataAccessor.getTelegrafActionMetadata(
|
||||
instance[key],
|
||||
);
|
||||
this.handleTelegrafAction(instance, key, telegraf, metadata);
|
||||
}
|
||||
},
|
||||
);
|
||||
@@ -202,4 +207,14 @@ export class TelegrafExplorer implements OnModuleInit {
|
||||
// @ts-ignore
|
||||
telegraf.cashtag(metadata.cashtag, instance[key].bind(instance));
|
||||
}
|
||||
|
||||
handleTelegrafAction(
|
||||
instance: object,
|
||||
key: string,
|
||||
telegraf: Telegraf<ContextMessageUpdate>,
|
||||
metadata: any,
|
||||
) {
|
||||
// @ts-ignore
|
||||
telegraf.cashtag(metadata.triggers, instance[key].bind(instance));
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user