提交 cc32a95b 编写于 作者: Huan (李卓桓)'s avatar Huan (李卓桓)

add all main class to docs

上级 f96e5088
## Classes
<dl>
<dt><a href="#Wechaty">Wechaty</a></dt>
<dd><p>Wechaty: Wechat for ChatBots.
Connect ChatBots</p>
<p>Class Wechaty</p>
<p>Licenst: ISC
<a href="https://github.com/zixia/wechaty">https://github.com/zixia/wechaty</a></p>
<p><strong>Example</strong></p>
<pre><code class="lang-ts">// The World&#39;s Shortest ChatBot Code: 6 lines of JavaScript
const { Wechaty } = require(&#39;wechaty&#39;)
Wechaty.instance() // Singleton
.on(&#39;scan&#39;, (url, code) =&gt; console.log(`Scan QR Code to login: ${code}\n${url}`))
.on(&#39;login&#39;, user =&gt; console.log(`User ${user} logined`))
.on(&#39;message&#39;, message =&gt; console.log(`Message: ${message}`))
.init()
</code></pre>
</dd>
<dt><a href="#Room">Room</a></dt>
<dd><p>wechaty: Wechat for Bot. and for human who talk to bot/robot</p>
<p>Licenst: ISC
<a href="https://github.com/zixia/wechaty">https://github.com/zixia/wechaty</a></p>
<p>Add/Del/Topic: <a href="https://github.com/wechaty/wechaty/issues/32">https://github.com/wechaty/wechaty/issues/32</a></p>
</dd>
<dt><a href="#Contact">Contact</a></dt>
<dd><p>Class Contact
blabla...
<strong>IMPORTANT</strong></p>
</dd>
</dl>
## Constants
<dl>
<dt><a href="#config_1">config_1</a></dt>
<dd><p>Wechaty: <em> </em> Wechaty - Wechat for Bot. Connecting ChatBots</p>
<p>Licenst: ISC
<a href="https://github.com/wechaty/wechaty">https://github.com/wechaty/wechaty</a></p>
</dd>
</dl>
<a name="Wechaty"></a>
## Wechaty
......@@ -29,12 +72,12 @@ Wechaty.instance() // Singleton
* [Wechaty](#Wechaty)
* _instance_
* [.version([forceNpm])](#Wechaty+version)<code>string</code>
* ~~[.user()](#Wechaty+user)<code>Contact</code>~~
* ~~[.user()](#Wechaty+user)<code>[Contact](#Contact)</code>~~
* [.init()](#Wechaty+init)
* [.on()](#Wechaty+on)
* [.quit()](#Wechaty+quit)
* [.logout()](#Wechaty+logout)
* [.self()](#Wechaty+self)<code>Contact</code>
* [.self()](#Wechaty+self)<code>[Contact](#Contact)</code>
* [.send()](#Wechaty+send)
* [.say()](#Wechaty+say)
* [.sleep()](#Wechaty+sleep)
......@@ -62,7 +105,7 @@ console.log(Wechaty.instance().version())
```
<a name="Wechaty+user"></a>
### ~~wechaty.user() ⇒ <code>Contact</code>~~
### ~~wechaty.user() ⇒ <code>[Contact](#Contact)</code>~~
***Deprecated***
**Kind**: instance method of <code>[Wechaty](#Wechaty)</code>
......@@ -104,11 +147,11 @@ console.log(Wechaty.instance().version())
<a name="Wechaty+self"></a>
### wechaty.self() ⇒ <code>Contact</code>
### wechaty.self() ⇒ <code>[Contact](#Contact)</code>
get current user
**Kind**: instance method of <code>[Wechaty](#Wechaty)</code>
**Returns**: <code>Contact</code> - current logined user
**Returns**: <code>[Contact](#Contact)</code> - current logined user
<a name="Wechaty+send"></a>
### wechaty.send()
......@@ -139,3 +182,73 @@ get current user
get the singleton instance of Wechaty
**Kind**: static method of <code>[Wechaty](#Wechaty)</code>
<a name="Room"></a>
## Room
wechaty: Wechat for Bot. and for human who talk to bot/robot
Licenst: ISC
https://github.com/zixia/wechaty
Add/Del/Topic: https://github.com/wechaty/wechaty/issues/32
**Kind**: global class
<a name="Room.load"></a>
### Room.load()
**Kind**: static method of <code>[Room](#Room)</code>
**Todo**
- [ ] document me
<a name="Contact"></a>
## Contact
Class Contact
blabla...
**IMPORTANT**
**Kind**: global class
* [Contact](#Contact)
* _instance_
* [.gender()](#Contact+gender)
* [.avatar()](#Contact+avatar)
* _static_
* [.findAll()](#Contact.findAll)
* [.find()](#Contact.find)
<a name="Contact+gender"></a>
### contact.gender() ⇒
Contact gender
**Kind**: instance method of <code>[Contact](#Contact)</code>
**Returns**: Gender.Male(2) | Gender.Female(1) | Gender.Unknown(0)
<a name="Contact+avatar"></a>
### contact.avatar()
Get avatar picture file stream
**Kind**: instance method of <code>[Contact](#Contact)</code>
<a name="Contact.findAll"></a>
### Contact.findAll()
find contact by `name` or `alias`
**Kind**: static method of <code>[Contact](#Contact)</code>
<a name="Contact.find"></a>
### Contact.find()
try to find a contact by filter: {name: string | RegExp}
**Kind**: static method of <code>[Contact](#Contact)</code>
<a name="config_1"></a>
## config_1
Wechaty: * * Wechaty - Wechat for Bot. Connecting ChatBots
Licenst: ISC
https://github.com/wechaty/wechaty
**Kind**: global constant
......@@ -18,7 +18,7 @@
"ava": "ava --verbose --extension ts",
"ts-node": "ts-node",
"dist": "npm run clean && tsc && shx cp package.json dist/ && shx cp src/puppet-web/*.js dist/src/puppet-web/",
"doc": "npm run dist && jsdoc2md dist/src/wechaty.js > docs/index.md",
"doc": "npm run dist && jsdoc2md dist/src/{wechaty,room,contact,friend-request,message}.js > docs/index.md",
"coverage": "nyc report --reporter=text-lcov | coveralls",
"changelog": "github_changelog_generator -u wechaty -p wechaty && sed -i /greenkeeper/d CHANGELOG.md",
"doctor": "npm run check-node-version && ts-node bin/doctor",
......
/**
*
* wechaty: Wechat for Bot. and for human who talk to bot/robot
*
* Licenst: ISC
* https://github.com/zixia/wechaty
*
*/
import {
Config
, Sayable
......@@ -61,6 +53,12 @@ export type ContactQueryFilter = {
remark?: string | RegExp
}
/**
* Class Contact
* blabla...
* **IMPORTANT**
*
*/
export class Contact implements Sayable {
private static pool = new Map<string, Contact>()
......@@ -115,7 +113,7 @@ export class Contact implements Sayable {
public star() { return this.obj && this.obj.star }
/**
* Contact gender
* @return Gender.Male(2) | Gender.Female(1) | Gender.Unknown(0)
* @returns Gender.Male(2) | Gender.Female(1) | Gender.Unknown(0)
*/
public gender() { return this.obj ? this.obj.sex : Gender.Unknown }
public province() { return this.obj && this.obj.province }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册