How to use the bottender.withProps function in bottender

To help you get started, we’ve selected a few bottender 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 Yoctol / bottender / examples / messenger-built-in-nlp / index.js View on Github external
module.exports = async function App(context) {
  console.log(context.event.message.nlp.entities);
  const { datetime } = context.event.message.nlp.entities;

  if (!datetime) {
    return NoDatetime;
  }

  return withProps(ReplyDatetime, { datetime: datetime[0] });
};
github Yoctol / bottender / examples / todos / index.js View on Github external
module.exports = async function App(context) {
  return router([
    text('/list', withProps(ShowTodos, { todos: context.state.todos })),
    text('/clear', ClearTodos),
    text('*', AddTodo),
  ]);
};
github tigercosmos / vocabulary-titan / index.js View on Github external
const data = cache.get(context.state.word);

  if (context.state.word == '' || data === undefined) {
    return HintEnterNewWord;
  }

  const Router = router([
    text('1', HandleNumber1),
    text('2', HandleNumber2),
    text('3', HandleNumber3),
    text('4', HandleNumber4),
    text('5', HandleNumber5),
    text('*', HandleOtherNumber),
  ]);

  return withProps(Router, { data });
}