awesomebot
v0.0.3
Published
🤖 Universal micro chatbot platform ⚡ https://github.com/noveogroup-amorgunov/awesomebot
Downloads
8
Readme
awesomebot
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:
- :snowman: telegram-hello-world - telegram example bot
- echo-bot
- async-middleware - notify the execution time
- handle-error - custom function for handling errors
- todos - todolist
- with-regexp - exucate middleware by cetrain regexp/string (like command)
- with-state - operate with session state
- :fire: giphy-bot - find any gif by keywords
- session-store-mongo - use MongoDB as session store