From f8b9011a5371a36bbbe3d214e05513b56e0d5327 Mon Sep 17 00:00:00 2001 From: gasolin Date: Fri, 5 Aug 2016 22:47:12 +0800 Subject: [PATCH] add developer and changelog section --- README.md | 46 +++++++++++++++++++++++++++++++++++++++++++++- huohubot.js | 1 - 2 files changed, 45 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 3f58967..af11fd7 100644 --- a/README.md +++ b/README.md @@ -5,16 +5,28 @@ Check [Online Demo](https://gasolin.github.io/huohubot/) ## Features +* Chat bot works in your browser without setup a server * Tiny size (80 lines that contain the core with 3 plugins in init version) that easy to understand and suit for embed in any web site * Structure is inspired by [hubot](https://github.com/github/hubot/), which is a server side chatbot framework * Provide plugin architecture that able to expand functions * Regex based message matching * Plugin callbacks are extremely flexible, you can control in-page elements, execute local command, fetch remote data, trigger remote actions... + * can extend bot functionality by import addons ## How to Install -Clone the project then include the huohubot.js in your html file with 2 extra tags: +### Method 1 + +If you just want to try how the bot looks like, Check [Online Demo](https://gasolin.github.io/huohubot/) + +### Method 2 + +If you want to modify it locally, clone the project, then drag index.html to your browser, now you have a working bot! + +### Method 3 + +If you want embed bot into your web site, clone the project then include the `huohubot.js` in your html file with 2 extra tags: ```html
@@ -49,6 +61,38 @@ bot: Hello World! ![Imgur](http://i.imgur.com/Ljjf0Fw.png) +## Developer + +Open browser's devtool and you can start manipulate `Huohubot` object. +Plugins are located in `Huohubot.rules`, and that is the place all you need to deal with. + +### Make an addon + +You can extend Huohubot's functionality by import extra `huohubot-[addonName].js`: + +```js +'use strict'; +if (!Huohubot) { + return +} + +Huohubot.prototype.addonName = { + ... +}; +``` + +then include the js file after `huohubot.js`. + +```html +... + + +``` + ## License Huohubot use MIT License + +## ChangeLog + +* 0.1 2016/8/5 init version diff --git a/huohubot.js b/huohubot.js index 61a99cc..ccd9dfc 100644 --- a/huohubot.js +++ b/huohubot.js @@ -36,7 +36,6 @@ var HuohuBot = { onReceive: function() { var receiveMsg = this.message.value; - //console.log('receiveMsg:' + receiveMsg); this.chatHistory.push(this.myAlias + ': ' + receiveMsg); this.processListeners(receiveMsg); },