## v0.5.1 master (2016/10) The First Typescript Version
1. Converted to Typescript (2016/10/11) [#40](https://github.com/wechaty/wechaty/issues/40)
1. Dockerize Wechaty for easy start [#66](https://github.com/wechaty/wechaty/issues/66)
1. Sayablization: Make Wechaty/Contact/Room `Sayable`, and all `this` inside wechaty event listeners are `Sayable` too. [#41](https://github.com/wechaty/wechaty/issues/41)
1. BREAKING CHANGE: global event `scan` listener arguments changed from 1 to 2: now is `function(this: Sayable, url: string, code: number)` instead of `function({url, code})` before.
1. add test with Node.js v7.0 in CI
1. add `npm run doctor` to diagnose wechaty and output useful debug information
## [v0.4.0](https://github.com/wechaty/wechaty/releases/tag/v0.4.0) (2016/10/9) The Latest Javascript Version
1. [#32](https://github.com/wechaty/wechaty/issues/32) Extend Room Class with:
1. Global events: `room-join`, `room-leave`, `room-topic`
1. Room events: `join`, `leave`, `topic`
1. Create a new Room: `Room.create()`
1. Add/Del/Topic for Room
1. Other methods like nick/member/has/etc...
1. [#33](https://github.com/wechaty/wechaty/issues/33) New Class `FriendRequest` with:
1. `Wechaty.on('friend', function(contact: Contact, request: FriendRequest) {})` with Wechaty new Event `friend`
1. `request.accept()` to accept a friend request
1. `requestsend()` to send new friend request
## v0.3.13 (2016/09)
1. Managed by Cloud Manager: https://app.wechaty.io
1. Dockerized & Published to docker hub as: [zixia/wechaty](https://hub.docker.com/r/zixia/wechaty/)
1. Add `reset` & `shutdown` to IO Event
1. Switch Unit Test Runner from Tape/Tap to [AVA](https://github.com/avajs/ava)
1. Move git resposity from zixia/wechaty to [wechaty/wechaty](https://github.com/wechaty/wechaty)
## v0.2.3 (2016/7/28)
1. add wechaty.io cloud management support: set environment variable `WECHATY_TOKEN` to enable io support
2. rename `WECHATY_SESSION` to `WECHATY_PROFILE` for better name
3. fix watchdog timer & reset bug
## v0.1.8 (2016/6/25)
1. add a watchdog to restore from unknown state
2. add support to download image message by `ImageMessage.readyStream()`
3. fix lots of stable issues with webdriver exceptions & injection js code compatible
## v0.1.1 (2016/6/10)
1. add support to save & restore wechat login session
1. add continuous integration tests on win32 platform. (powered by [AppVeyor](https://www.appveyor.com/))
1. add environment variables HEAD/PORT/SESSION/DEBUG to config Wechaty
## v0.0.10 (2016/5/28)
1. use event `scan` to show image url of login QR Code(and detect state change)
@@ -153,55 +153,19 @@ Use NPM is recommended to install a stable version of Wechaty published on NPM.c
npm install--save wechaty
```
If you use chrome instead of phantomjs, you should make sure:
1. installed Chrome correctly
1. if you are under Linux, set headless right for `Xvfb`
*[Running a GUI application in a Docker container](https://linuxmeerkat.wordpress.com/2014/10/17/running-a-gui-application-in-a-docker-container/)
Then you are set.
## Install to Cloud9 IDE
[Cloud9 IDE](https://c9.io/) is Google Docs for Code, which is my favorite IDE today. Almost all my wechaty development based on Cloud9(Before Oct 2016, or v0.0.5).
> Cloud9 IDE written in JavaScript uses Node.js on the back-end. It uses Docker containers for its workspaces and hosted on Google Compute Engine.
### 1. Open in Cloud9 IDE
Just one click here: <ahref="https://c9.io/open/?name=Wechaty&type=nodejs&clone_url=https://github.com/wechaty/wechaty.git&description=Wechat%20for%20Bot&selection_file=/example/ding-dong-bot.ts"target="_blank"><imgsrc="https://img.shields.io/badge/open%20in-Cloud9%20IDE-blue.svg"alt="Open Wechaty in Cloud9 IDE"></a>
### 2. Set default to Node.js v6
Open Terminal in Cloud9 IDE, use nvm to install nodejs v6, which is required by Wechaty.
The above command will clone wechaty source code to your current directory.
### 3. Run Demo Bot
```shell
cd wechaty
npm install
...
...
@@ -227,11 +192,6 @@ After a little while, the bot will show you a message of a URL for Login QR Code
### 4. Done
## Setup `Xvfb` in linux
[How to Install & Run Wechaty in Linux Server by @lijiarui](https://github.com/wechaty/wechaty/issues/48)
Enjoy hacking Wechaty!
Please submit your issue if you have any, and a fork & pull is very welcome for showing your idea.
...
...
@@ -253,33 +213,16 @@ Please submit your issue if you have any, and a fork & pull is very welcome for
</a>
```
# About TypeScript
[Typescript](http://www.typescriptlang.org/) is JavaScript that scales. It comes from Microsoft, and is the popularest language in [Google Angular](https://angular.io).
# Documented
## Benifits from Typescript
## wiki
Wechaty is fully typed by TypeScript since v0.5, 12th Oct 2016. And got benefits as the following:
1. [[IDE|IDE]]
1. [[Xvfb|Xvfb]]
1. [[TypeScript|TypeScript]]
1. [[NpmLog|NpmLog]]
1. [[SimilarProject|SimilarProject]]
1. Better async coding style: `async`/`await` (now we use `co` module)
1. Strong type definition/checking for data structure
1. Auto completion/Static syntax check with [VSCode IDE](https://code.visualstudio.com)
1. Static variable that can initializing inside class
1. Public/private setting for methods/member variables
1. other benefits...
The lastest javascript version is: [v0.4.0](https://github.com/wechaty/wechaty/releases/tag/v0.4.0)(2016/10/9)
## Reference
1.[The Future of Declaration Files](https://blogs.msdn.microsoft.com/typescript/2016/06/15/the-future-of-declaration-files/)
1.[What's new in TypeScript](https://github.com/Microsoft/TypeScript/wiki/What's-new-in-TypeScript)
1.[Why we decided to move from plain JavaScript to TypeScript for Babylon.js](https://www.eternalcoding.com/?p=103)
1.[Migrating from JavaScript](https://www.typescriptlang.org/docs/handbook/migrating-from-javascript.html)
* Work Log: https://github.com/wechaty/wechaty/issues/40
[VSCode](https://code.visualstudio.com/) is highly recommended as developing IDE for Wechaty with TypeScript because we can get the benefit of [intelligent code completion, parameter info, and member lists](https://code.visualstudio.com/docs/languages/javascript).
# Trouble Shooting
...
...
@@ -328,31 +271,6 @@ mode con lines=32766
```
> http://stackoverflow.com/a/8775884/1123955
### NpmLog with Timestamp ###
Here's a quick and dirty patch, to npmlog/log.js
```typescript
m.message.split(/\r?\n/).forEach(function(line){
vardate=newDate();
varmin=date.getMinutes()
varsec=date.getSeconds()
varhour=date.getHours()
if(sec<10){sec='0'+sec}
if(min<10){min='0'+min}
if(hour<10){hour='0'+hour}
this.write(hour+':'+min+':'+sec+'')
if(this.heading){
this.write(this.heading,this.headingStyle)
this.write('')
}
```
And we can look forward the official support from npmlog: https://github.com/npm/npmlog/pull/24
## DEBUG
set environment variable WECHATY_DEBUG to enable DEBUG in Wechaty.
...
...
@@ -806,60 +724,7 @@ npm test
# Version History
## v0.5.0 master (2016/10) The First Typescript Version
1. Converted to Typescript (2016/10/11) [#40](https://github.com/wechaty/wechaty/issues/40)
1. Dockerize Wechaty for easy start [#66](https://github.com/wechaty/wechaty/issues/66)
1. Sayablization: Make Wechaty/Contact/Room `Sayable`, and all `this` inside wechaty event listeners are `Sayable` too. [#41](https://github.com/wechaty/wechaty/issues/41)
1. BREAKING CHANGE: global event `scan` listener arguments changed from 1 to 2: now is `function(this: Sayable, url: string, code: number)` instead of `function({url, code})` before.
1. add test with Node.js v7.0 in CI
1. add `npm run doctor` to diagnose wechaty and output useful debug information
## [v0.4.0](https://github.com/wechaty/wechaty/releases/tag/v0.4.0) (2016/10/9) The Latest Javascript Version
1.[#32](https://github.com/wechaty/wechaty/issues/32) Extend Room Class with:
1. Global events: `room-join`, `room-leave`, `room-topic`
1. Room events: `join`, `leave`, `topic`
1. Create a new Room: `Room.create()`
1. Add/Del/Topic for Room
1. Other methods like nick/member/has/etc...
1.[#33](https://github.com/wechaty/wechaty/issues/33) New Class `FriendRequest` with:
1.`Wechaty.on('friend', function(contact: Contact, request: FriendRequest) {})` with Wechaty new Event `friend`
1.`request.accept()` to accept a friend request
1.`requestsend()` to send new friend request
## v0.3.13 (2016/09)
1. Managed by Cloud Manager: https://app.wechaty.io
1. Dockerized & Published to docker hub as: [zixia/wechaty](https://hub.docker.com/r/zixia/wechaty/)
1. Add `reset` & `shutdown` to IO Event
1. Switch Unit Test Runner from Tape/Tap to [AVA](https://github.com/avajs/ava)
1. Move git resposity from zixia/wechaty to [wechaty/wechaty](https://github.com/wechaty/wechaty)
## v0.2.3 (2016/7/28)
1. add wechaty.io cloud management support: set environment variable `WECHATY_TOKEN` to enable io support
2. rename `WECHATY_SESSION` to `WECHATY_PROFILE` for better name
3. fix watchdog timer & reset bug
## v0.1.8 (2016/6/25)
1. add a watchdog to restore from unknown state
2. add support to download image message by `ImageMessage.readyStream()`
3. fix lots of stable issues with webdriver exceptions & injection js code compatible
## v0.1.1 (2016/6/10)
1. add support to save & restore wechat login session
1. add continuous integration tests on win32 platform. (powered by [AppVeyor](https://www.appveyor.com/))
1. add environment variables HEAD/PORT/SESSION/DEBUG to config Wechaty
## v0.0.10 (2016/5/28)
1. use event `scan` to show image url of login QR Code(and detect state change)
1.[:speech_balloon: A better WeChat on MacOS and Linux. Fewer bugs, more features. Built with Electron by Zhongyi Tong.](https://github.com/geeeeeeeeek/electronic-wechat)
1.[WeChat.NET](https://github.com/sherlockchou86/WeChat.NET) WeChat.NET client based on web wechat
## Chat Script
1.[SuperScript](http://superscriptjs.com/) A dialog system and bot engine for conversational UI's. (Pure Javascript)
2.[RiveScript](https://www.rivescript.com/) A simple scripting language for giving intelligence to chatbots and other conversational entities. (Perl original, Multi-Language support)