@@ -7,7 +7,7 @@ Wechaty is a Bot Framework for Wechat **Personal** Account.
> Easy creating personal wechat bot in 9 lines of code.
Supports [linux](https://travis-ci.org/zixia/wechaty), [win32](https://ci.appveyor.com/project/zixia/wechaty) and darwin(OSX/Mac).
It supports [linux](https://travis-ci.org/zixia/wechaty), [win32](https://ci.appveyor.com/project/zixia/wechaty) and darwin(OSX/Mac).
[![Join the chat at https://gitter.im/zixia/wechaty](https://badges.gitter.im/zixia/wechaty.svg)](https://gitter.im/zixia/wechaty?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
After the bot login full successful, the event `login` will be emitted, with a [Contact](#class-contact) of current logined user.
```javascript
wechaty.on('login',user=>{
console.log(`user ${user} logined`)
console.log(`user ${user} login`)
})
```
### 3. Event: `logout`
`logout` will be emitted when bot detected it is logout.
`logout` will be emitted when bot detected it is logout, with a [Contact](#class-contact) of current logined user.
```javascript
wechaty.on('logout',user=>{
console.log(`user ${user} logout`)
})
```
### 4. Event: `message`
Emit when there's a new message.
...
...
@@ -271,23 +279,17 @@ To be support.
Main bot class.
```javascript
constwechaty=newWechaty({
constbot=newWechaty({
profile
,head
,token
})
```
options:
1.`profile`(OPTIONAL): profile name. if a profile name is provided, the login status will be saved to it, and automatically restored on next time of wechaty start(restart).
* can be set by environment variable: `WECHATY_PROFILE`
1.`head`(OPTIONAL): specify the browser name for webdriver.
* can be set by environment variable: `WECHATY_HEAD`
* values:
*`phantomjs`: it's the default behaviour if head is not set.
*`chrome`
1.`token`(OPTIONAL): wechaty io token. Be used to connect to cloud bot manager.