0

TelegrafJS async handler middleware

Function JavaScript 3 revisions 110 a month ago a month ago
module.exports = handler =>
    (ctx, next) => {
        handler(ctx, next).catch(error => {
            console.error(error);
        });
    };
bot.start(asyncHandler(async ctx => {
    // Do some async stuff
}));