How to use the telegraf.Composer.compose function in telegraf

To help you get started, we’ve selected a few telegraf examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github EdJoPaTo / telegraf-inline-menu / source / index.js View on Github external
const middleware = submenu.middleware(childActionCode, subOptions)
        return createHandlerMiddleware(middleware, {
          only: ctx => !ctx.callbackQuery || childActionCode.testIsBelow(ctx.callbackQuery.data),
          hide,
          hiddenFunc
        })
      })

    const responderMiddleware = this.responders.createMiddleware({
      actionCode,
      setMenuFunc,
      setParentMenuFunc: options.setParentMenuFunc
    })

    return Composer.compose([
      responderMiddleware,
      ...functions,
      ...handlerFuncs
    ])
  }
github EdJoPaTo / telegraf-inline-menu / source / index.ts View on Github external
.addOnly(ctx => !ctx.callbackQuery || !ctx.callbackQuery.data || childActionCode.testIsBelow(ctx.callbackQuery.data))

        if (hide) {
          m.addHide(hide)
        }

        return m.middleware()
      })

    const responderMiddleware = this.responders.createMiddleware({
      actionCode,
      setMenuFunc,
      setParentMenuFunc: options.setParentMenuFunc
    })

    return Composer.compose([
      responderMiddleware,
      ...functions,
      ...handlerFuncs
    ])
  }
github EdJoPaTo / telegraf-inline-menu / source / menu-responders.ts View on Github external
createMiddleware(environment: ResponderEnvironment): Middleware {
    const {actionCode, setMenuFunc} = environment
    const menuMiddleware = Composer.action(actionCode.get(), async ctx => setMenuFunc(ctx, 'menu action'))

    return Composer.compose([
      menuMiddleware,
      ...this.responders
        .map(o => createMiddlewareFromResponder(o, environment))
    ])
  }
}