fix(params-factory): add data propery check (#231)

This commit is contained in:
Morbo
2021-01-23 19:50:32 +03:00
committed by GitHub
parent c7bc618c31
commit 0c50fca66e

View File

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