Code Monkey home page Code Monkey logo

webbybot's Introduction

Webbybot

**THIS PROJECT IS NOT MAINTAINED, please consider Hubot or my client-side attempt Saihubot **

Build Status codecov.io Dependency Status npm Join the chat at https://gitter.im/gasolin/webbybot

Webbybot is the next generation framework to build message/chat bots, written in ES6 and plain javascript. Fully compatible with Hubot's middleware and plugins.

The Differences:

  • Port hubot from CoffeeScript to ES6 (plain JS) with babel.
  • Auto test coverage report with Codecov.
  • Auto linting with eslint.
  • Support .env file to setup system parameters
  • robot.router upgraded to Express 4.x

The Same:

  • Still support hubot plugins written in coffeescript.
  • Can reuse hubot adapters*
  • Auto continue integration with Travis CI.
  • How it works(for now)
  • Support write plugin with plain Javascript

How to try Webbybot

You can start from webby-template , a template for make a working webby bot

$ git clone https://github.com/gasolin/webby-template.git demo
$ cd demo
$ npm install
$ ./bin/webby

You can find and install extra skills from npm

Enable a skill in external-scripts.json.

Add the environment variables in .env file.

How to replace Hubot to Webbybot

Refer to Getting Started With Hubot, Install hubot generator first

npm install -g yo generator-hubot

Then generate your robot with

yo hubot
  1. Enter the folder, edit bin/hubot and replace hubot to webby.

  2. install webbybot package

npm install --save webbybot
  1. modify adapter's dependency

Let's take telegram adapter for example. Edit node_modules/hubot-telegram/src/telegram.coffee and replace first line require 'hubot' to require 'webbybot'.

start your bot as normal

./bin/hubot

Tested with hubot-telegram and hubot-messenger.

Development

$ npm install -g mocha

Build

run command

$ npm run build

Add plugins

$ npm install hubot-calculator hubot-diagnostics

Add external-scripts.json file which contain:

[
  "hubot-diagnostics",
  "hubot-calculator"
]

Run

run command

$ node ./bin/webby
webby > ping
webby > PONG
webby > echo hello
webby > hello
webby > webby calc 1 + 1
webby > 2

Test

$ npm test

Lint

$ npm run lint

Write your own plugin

You can clone webby-plugin template to get start.

webby-template already bundled with webby-plugin. You can check how it work for reference.

License

MIT license

webbybot's People

Contributors

gasolin avatar gitter-badger avatar raylin avatar scarletsky avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

webbybot's Issues

Cannot read property 'robot' of undefined with hubot-timezone

input webby time in london

and got debug log with error:

[Wed Apr 13 2016 13:58:51 GMT+0800 (CST)] DEBUG Executing listener callback for Message '${message}'
[Wed Apr 13 2016 13:58:51 GMT+0800 (CST)] ERROR TypeError: Cannot read property 'robot' of undefined
  at http (/home/gasolin/webby-confbot/node_modules/webbybot/dist/src/response.js:224:18)
  at getTimezoneInfo (/home/gasolin/webby-confbot/node_modules/hubot-timezone/src/timezone.coffee:37:3)
  at sendLocalTime (/home/gasolin/webby-confbot/node_modules/hubot-timezone/src/timezone.coffee:77:5)
  at convertTime (/home/gasolin/webby-confbot/node_modules/hubot-timezone/src/timezone.coffee:92:5)
  at TextListener.callback (/home/gasolin/webby-confbot/node_modules/hubot-timezone/src/timezone.coffee:116:5)
  at executeListener (/home/gasolin/webby-confbot/node_modules/webbybot/dist/src/listener.js:116:19)
  at allDone (/home/gasolin/webby-confbot/node_modules/webbybot/dist/src/middleware.js:85:16)
  at /home/gasolin/webby-confbot/node_modules/webbybot/node_modules/async/lib/async.js:380:13
  at /home/gasolin/webby-confbot/node_modules/webbybot/node_modules/async/lib/async.js:52:16
  at iterate (/home/gasolin/webby-confbot/node_modules/webbybot/node_modules/async/lib/async.js:260:24)
  at Object.async.forEachOfSeries.async.eachOfSeries (/home/gasolin/webby-confbot/node_modules/webbybot/node_modules/async/lib/async.js:281:9)
  at Object.async.inject.async.foldl.async.reduce (/home/gasolin/webby-confbot/node_modules/webbybot/node_modules/async/lib/async.js:374:15)
  at /home/gasolin/webby-confbot/node_modules/webbybot/dist/src/middleware.js:91:22
  at nextTickCallbackWith0Args (node.js:420:9)
  at process._tickCallback (node.js:349:13)

respond result is wrong

$ npm install hubot-calculator
$ npm run build
$ ./bin/webby.js
webby> webby calc 1+1

Expected result:

webby > 2

Actual result

webby > 0

The return result in hubot-calculator is correct (2), so there is something wrong in respond or middleware module.

fix robot tests

there's some skipped tests in robot_test related to middleware and listener

mock hubot require to webbybot to use adapters directly

currently webbybot needs to modify the require('hubot') statement from every hubot-adapters, its not that convenient.

We can use mockery or mock-require to proxy hubot require to webbybot, so every hubot requirement will be redirected to webbybot

enableHttpd flag undefined

The enableHttpd flag default isn't being properly handed off to the loadBot function in the bin script

Porting motivations

I saw a note somewhere about "porting Hubot from coffeescript to es6". What are the motivations for doing so vs just building on top of Hubot as-is?

use es6 module import

followup of #3.
We moved to es6 export, will replace require with import and remove add-module-exports babel plugin

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.