feat(param-decorators): add new paramtypes & make possible to get property from object

This commit is contained in:
Morb0
2021-01-06 20:49:50 +03:00
parent dc22f9f191
commit 4ca6e18d12
6 changed files with 47 additions and 17 deletions

View File

@@ -18,11 +18,9 @@ export class TelegrafParamsFactory implements ParamsFactory {
case TelegrafParamtype.NEXT:
return next;
case TelegrafParamtype.SENDER:
return ctx.from;
return ctx.from ? ctx.from[data as string] : ctx.from;
case TelegrafParamtype.MESSAGE:
return ctx.message;
case TelegrafParamtype.MESSAGE_TEXT:
return ctx.message.text;
return ctx.message ? ctx.message[data as string] : ctx.message;
default:
return null;
}