mirror of
				https://github.com/Maks1mS/nestjs-telegraf.git
				synced 2025-10-31 14:01:22 +03:00 
			
		
		
		
	feat(listeners-explorer): convert callback return data to string and reply
This commit is contained in:
		| @@ -5,7 +5,7 @@ import { MetadataScanner } from '@nestjs/core/metadata-scanner'; | |||||||
| import { Module } from '@nestjs/core/injector/module'; | import { Module } from '@nestjs/core/injector/module'; | ||||||
| import { ParamMetadata } from '@nestjs/core/helpers/interfaces'; | import { ParamMetadata } from '@nestjs/core/helpers/interfaces'; | ||||||
| import { ExternalContextCreator } from '@nestjs/core/helpers/external-context-creator'; | import { ExternalContextCreator } from '@nestjs/core/helpers/external-context-creator'; | ||||||
| import { BaseScene, Composer, Stage, Telegraf } from 'telegraf'; | import { BaseScene, Composer, Context, Stage, Telegraf } from 'telegraf'; | ||||||
|  |  | ||||||
| import { MetadataAccessorService } from './metadata-accessor.service'; | import { MetadataAccessorService } from './metadata-accessor.service'; | ||||||
| import { | import { | ||||||
| @@ -132,20 +132,19 @@ export class ListenersExplorerService | |||||||
|     ); |     ); | ||||||
|  |  | ||||||
|     const { method, args } = metadata; |     const { method, args } = metadata; | ||||||
|     composer[method](...args, listenerCallbackFn); |  | ||||||
|  |     /* Basic callback */ | ||||||
|  |     // composer[method](...args, listenerCallbackFn); | ||||||
|  |  | ||||||
|     /* Complex callback return value handing */ |     /* Complex callback return value handing */ | ||||||
|     // composer[method]( |     composer[method]( | ||||||
|     //   ...args, |       ...args, | ||||||
|     //   async (ctx: Context, next: Function): Promise<void> => { |       async (ctx: Context, next: Function): Promise<void> => { | ||||||
|     //     const result = await listenerCallbackFn(ctx, next); |         const result = await listenerCallbackFn(ctx, next); | ||||||
|     // |         await ctx.reply(String(result)); | ||||||
|     //     // TODO: Add more supported return types |         // TODO-Possible-Feature: Add more supported return types | ||||||
|     //     if (typeof result === 'string') { |       }, | ||||||
|     //       await ctx.reply(result); |     ); | ||||||
|     //     } |  | ||||||
|     //   }, |  | ||||||
|     // ); |  | ||||||
|   } |   } | ||||||
|  |  | ||||||
|   createContextCallback<T extends Record<string, unknown>>( |   createContextCallback<T extends Record<string, unknown>>( | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user