0.0.3 • Published 6 years ago

awesomebot v0.0.3

Weekly downloads
-
License
ISC
Repository
-
Last release
6 years ago

awesomebot

npm.io

Make your awesome bots :robot: in few steps!

  • Written with :zap: ES6/ES7 javascript syntax
  • Very easy to use
  • Use custom session store, platform connector with same interface
  • Support telegram

Installation

You can install awesomebot from npm or yarn

npm install awesomebot --save

or

yarn add awesomebot

Examples

You can find a lot of examples in the examples folder :rocket:.

Here is the simple example of usign awesomebot as the echo-bot. It always says what you said. There is used async/await function as message's handler.

const {ConsoleConnector, ConsoleBot} = require('awesomebot');

 // Create "console" connector to listen process.stdin
const connector = new ConsoleConnector().listen();
const bot = new ConsoleBot({connector});

// Middleware for handling messages
bot.use(async (ctx, next) => {
    const {text} = ctx.event; // Get user's message
    await ctx.session.send(`> You said: ${text}`); // Send back
    next();
});

You can run script and type text to console:

hello bot
> You said: hello bot
yo
> You said: you

Another examples: