mirror of
https://github.com/Maks1mS/nestjs-telegraf.git
synced 2025-12-17 02:39:52 +03:00
feat(decorators): TelegrafHelp added
This commit is contained in:
@@ -41,8 +41,6 @@ export class TelegrafExplorer implements OnModuleInit {
|
||||
(key: string) => {
|
||||
if (this.metadataAccessor.isTelegrafUse(instance[key])) {
|
||||
this.handleTelegrafUse(instance, key, telegraf);
|
||||
} else if (this.metadataAccessor.isTelegrafStart(instance[key])) {
|
||||
this.handleTelegrafStart(instance, key, telegraf);
|
||||
} else if (this.metadataAccessor.isTelegrafOn(instance[key])) {
|
||||
const metadata = this.metadataAccessor.getTelegrafOnMetadata(
|
||||
instance[key],
|
||||
@@ -58,6 +56,10 @@ export class TelegrafExplorer implements OnModuleInit {
|
||||
instance[key],
|
||||
);
|
||||
this.handleTelegrafCommand(instance, key, telegraf, metadata);
|
||||
} else if (this.metadataAccessor.isTelegrafStart(instance[key])) {
|
||||
this.handleTelegrafStart(instance, key, telegraf);
|
||||
} else if (this.metadataAccessor.isTelegrafHelp(instance[key])) {
|
||||
this.handleTelegrafHelp(instance, key, telegraf);
|
||||
}
|
||||
},
|
||||
);
|
||||
@@ -81,14 +83,6 @@ export class TelegrafExplorer implements OnModuleInit {
|
||||
telegraf.on(metadata.updateTypes, instance[key].bind(instance));
|
||||
}
|
||||
|
||||
handleTelegrafStart(
|
||||
instance: object,
|
||||
key: string,
|
||||
telegraf: Telegraf<ContextMessageUpdate>,
|
||||
) {
|
||||
telegraf.start(instance[key].bind(instance));
|
||||
}
|
||||
|
||||
handleTelegrafHears(
|
||||
instance: object,
|
||||
key: string,
|
||||
@@ -106,4 +100,20 @@ export class TelegrafExplorer implements OnModuleInit {
|
||||
) {
|
||||
telegraf.command(metadata.commands, instance[key].bind(instance));
|
||||
}
|
||||
|
||||
handleTelegrafStart(
|
||||
instance: object,
|
||||
key: string,
|
||||
telegraf: Telegraf<ContextMessageUpdate>,
|
||||
) {
|
||||
telegraf.start(instance[key].bind(instance));
|
||||
}
|
||||
|
||||
handleTelegrafHelp(
|
||||
instance: object,
|
||||
key: string,
|
||||
telegraf: Telegraf<ContextMessageUpdate>,
|
||||
) {
|
||||
telegraf.help(instance[key].bind(instance));
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user