How to use the bottender.ConsoleBot 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 / with-unit-tests / bot.js View on Github external
const { ConsoleBot } = require('bottender');

const handler = require('./handler');

const bot = new ConsoleBot();

bot.onEvent(handler);

module.exports = bot;
github Yoctol / bottender / examples / middleware / index.js View on Github external
const { ConsoleBot, middleware } = require('bottender');

const bot = new ConsoleBot();

const handler1 = async (context, next) => {
  await context.sendText('Hi there 1!');
  await next();
  await context.sendText('Hi there 3!');
};

const handler2 = async context => {
  await context.sendText('Hi there 2!');
};

bot.onEvent(middleware([handler1, handler2]));

bot.createRuntime();
github Yoctol / bottender / examples / console-hello-world / index.js View on Github external
const { ConsoleBot } = require('bottender');

const bot = new ConsoleBot({ fallbackMethods: true });

bot.onEvent(async context => {
  await context.sendText('Hello World');
});

bot.createRuntime();