Skip to content

Commit

Permalink
regenerate as wechaty/wechaty#1475
Browse files Browse the repository at this point in the history
  • Loading branch information
lijiarui committed Jul 13, 2018
1 parent a7bf237 commit a9a44ce
Show file tree
Hide file tree
Showing 26 changed files with 186 additions and 439 deletions.
8 changes: 4 additions & 4 deletions docs/api/README.md
Expand Up @@ -27,11 +27,11 @@ If you want to know how to get contact, see [Contact](/api/contact)</p>
</dd>
<dt>[Room](/api/room)</dt>
<dd><p>All wechat rooms(groups) will be encapsulated as a Room.</p>
<p><a href="https://github.com/Chatie/wechaty/blob/master/examples/room-bot.ts">Examples/Room-Bot</a></p>
<p><a href="https://github.com/Chatie/wechaty/blob/1523c5e02be46ebe2cc172a744b2fbe53351540e/examples/room-bot.ts">Examples/Room-Bot</a></p>
</dd>
<dt>[Contact](/api/contact)</dt>
<dd><p>All wechat contacts(friend) will be encapsulated as a Contact.</p>
<p><a href="https://github.com/Chatie/wechaty/blob/master/examples/contact-bot.ts">Examples/Contact-Bot</a></p>
<p><a href="https://github.com/Chatie/wechaty/blob/1523c5e02be46ebe2cc172a744b2fbe53351540e/examples/contact-bot.ts">Examples/Contact-Bot</a></p>
</dd>
<dt>[Friendship](/api/friendship)</dt>
<dd><p>Send, receive friend request, and friend confirmation events.</p>
Expand All @@ -40,11 +40,11 @@ If you want to know how to get contact, see [Contact](/api/contact)</p>
<li>receive request(in friend event)</li>
<li>confirmation friendship(friend event)</li>
</ol>
<p><a href="https://github.com/Chatie/wechaty/blob/master/examples/friend-bot.ts">Examples/Friend-Bot</a></p>
<p><a href="https://github.com/Chatie/wechaty/blob/1523c5e02be46ebe2cc172a744b2fbe53351540e/examples/friend-bot.ts">Examples/Friend-Bot</a></p>
</dd>
<dt>[Message](/api/message)</dt>
<dd><p>All wechat messages will be encapsulated as a Message.</p>
<p><a href="https://github.com/Chatie/wechaty/blob/master/examples/ding-dong-bot.ts">Examples/Ding-Dong-Bot</a></p>
<p><a href="https://github.com/Chatie/wechaty/blob/1523c5e02be46ebe2cc172a744b2fbe53351540e/examples/ding-dong-bot.ts">Examples/Ding-Dong-Bot</a></p>
</dd>
</dl>

Expand Down
10 changes: 5 additions & 5 deletions docs/api/contact.md
@@ -1,7 +1,7 @@
# Contact
All wechat contacts(friend) will be encapsulated as a Contact.

[Examples/Contact-Bot](https://github.com/Chatie/wechaty/blob/master/examples/contact-bot.ts)
[Examples/Contact-Bot](https://github.com/Chatie/wechaty/blob/1523c5e02be46ebe2cc172a744b2fbe53351540e/examples/contact-bot.ts)

**Kind**: global class

Expand Down Expand Up @@ -46,19 +46,19 @@ const bot = new Wechaty()
await bot.start()
const contact = await bot.Contact.find({name: 'lijiarui'}) // change 'lijiarui' to any of your contact name in wechat

# 1. send text to contact
// 1. send text to contact

await contact.say('welcome to wechaty!')

# 2. send media file to contact
// 2. send media file to contact

import { FileBox } from 'file-box'
const fileBox1 = FileBox.fromUrl('https://chatie.io/wechaty/images/bot-qr-code.png')
const fileBox2 = FileBox.fromLocal('/tmp/text.txt')
await contact.say(fileBox1)
await contact.say(fileBox2)

# 3. send contact card to contact
// 3. send contact card to contact

const contactCard = bot.Contact.load('contactId')
await contact.say(contactCard)
Expand Down Expand Up @@ -234,7 +234,7 @@ Get avatar picture file stream
**Kind**: instance method of [<code>Contact</code>](/api/contact)
**Example**
```js
# Save avatar to local file like `1-name.jpg`
// Save avatar to local file like `1-name.jpg`
const file = await contact.avatar()
const name = file.name
Expand Down
6 changes: 3 additions & 3 deletions docs/api/friendship.md
Expand Up @@ -5,7 +5,7 @@ Send, receive friend request, and friend confirmation events.
2. receive request(in friend event)
3. confirmation friendship(friend event)

[Examples/Friend-Bot](https://github.com/Chatie/wechaty/blob/master/examples/friend-bot.ts)
[Examples/Friend-Bot](https://github.com/Chatie/wechaty/blob/1523c5e02be46ebe2cc172a744b2fbe53351540e/examples/friend-bot.ts)

**Kind**: global class

Expand Down Expand Up @@ -37,13 +37,13 @@ bot.on('friendship', async friendship => {
console.log(`received friend event.`)
switch (friendship.type()) {

# 1. New Friend Request
// 1. New Friend Request

case Friendship.Type.Receive:
await friendship.accept()
break

# 2. Friend Ship Confirmed
// 2. Friend Ship Confirmed

case Friendship.Type.Confirm:
console.log(`friend ship confirmed`)
Expand Down
10 changes: 5 additions & 5 deletions docs/api/message.md
@@ -1,7 +1,7 @@
# Message
All wechat messages will be encapsulated as a Message.

[Examples/Ding-Dong-Bot](https://github.com/Chatie/wechaty/blob/master/examples/ding-dong-bot.ts)
[Examples/Ding-Dong-Bot](https://github.com/Chatie/wechaty/blob/1523c5e02be46ebe2cc172a744b2fbe53351540e/examples/ding-dong-bot.ts)

**Kind**: global class

Expand Down Expand Up @@ -133,7 +133,7 @@ bot
Reply a Text or Media File message to the sender.

**Kind**: instance method of [<code>Message</code>](/api/message)
**See**: [Examples/ding-dong-bot](https://github.com/Chatie/wechaty/blob/master/examples/ding-dong-bot.ts)
**See**: [Examples/ding-dong-bot](https://github.com/Chatie/wechaty/blob/1523c5e02be46ebe2cc172a744b2fbe53351540e/examples/ding-dong-bot.ts)

| Param | Type | Description |
| --- | --- | --- |
Expand All @@ -147,20 +147,20 @@ const bot = new Wechaty()
bot
.on('message', async m => {

# 1. send Image
// 1. send Image

if (/^ding$/i.test(m.text())) {
const fileBox = FileBox.fromUrl('https://chatie.io/wechaty/images/bot-qr-code.png')
await msg.say(fileBox)
}

# 2. send Text
// 2. send Text

if (/^dong$/i.test(m.text())) {
await msg.say('dingdingding')
}

# 3. send Contact
// 3. send Contact

if (/^lijiarui$/i.test(m.text())) {
const contactCard = await bot.Contact.find({name: 'lijiarui'})
Expand Down
10 changes: 5 additions & 5 deletions docs/api/room.md
@@ -1,7 +1,7 @@
# Room
All wechat rooms(groups) will be encapsulated as a Room.

[Examples/Room-Bot](https://github.com/Chatie/wechaty/blob/master/examples/room-bot.ts)
[Examples/Room-Bot](https://github.com/Chatie/wechaty/blob/1523c5e02be46ebe2cc172a744b2fbe53351540e/examples/room-bot.ts)

**Kind**: global class

Expand Down Expand Up @@ -52,22 +52,22 @@ await bot.start()
// after logged in...
const room = await bot.Room.find({topic: 'wechaty'})

# 1. Send text inside Room
// 1. Send text inside Room

await room.say('Hello world!')

# 2. Send media file inside Room
// 2. Send media file inside Room
import { FileBox } from 'file-box'
const fileBox1 = FileBox.fromUrl('https://chatie.io/wechaty/images/bot-qr-code.png')
const fileBox2 = FileBox.fromLocal('/tmp/text.txt')
await room.say(fileBox1)
await room.say(fileBox2)

# 3. Send Contact Card in a room
// 3. Send Contact Card in a room
const contactCard = await bot.Contact.find({name: 'lijiarui'}) // change 'lijiarui' to any of the room member
await room.say(contactCard)

# 4. Send text inside room and mention @mention contact
// 4. Send text inside room and mention @mention contact
const contact = await bot.Contact.find({name: 'lijiarui'}) // change 'lijiarui' to any of the room member
await room.say('Hello world!', contact)
```
Expand Down
30 changes: 15 additions & 15 deletions docs/api/wechaty.md
Expand Up @@ -27,7 +27,7 @@ See more:
* [.logout()](#Wechatylogout) <code>Promise.&lt;void&gt;</code>
* [.logonoff()](#Wechatylogonoff) <code>boolean</code>
* ~~[.self()](#Wechatyself)~~
* [.userSelf()](#WechatyuserSelf) [<code>Contact</code>](/api/contact)
* [.userSelf()](#WechatyuserSelf) <code>ContactSelf</code>
* [.say(textOrContactOrFile)](#Wechatysay) <code>Promise.&lt;void&gt;</code>
* [.version([forceNpm])](#Wechatyversion) <code>string</code>
* _static_
Expand Down Expand Up @@ -81,39 +81,39 @@ see advanced [chaining usage](https://github.com/Chatie/wechaty-getting-started/

**Example** *(Event:scan)*
```js
# Scan Event will emit when the bot needs to show you a QR Code for scanning
// Scan Event will emit when the bot needs to show you a QR Code for scanning

bot.on('scan', (url: string, code: number) => {
console.log(`[${code}] Scan ${url} to login.` )
})
```
**Example** *(Event:login )*
```js
# Login Event will emit when bot login full successful.
// Login Event will emit when bot login full successful.

bot.on('login', (user: ContactSelf) => {
console.log(`user ${user} login`)
})
```
**Example** *(Event:logout )*
```js
# Logout Event will emit when bot detected log out.
// Logout Event will emit when bot detected log out.

bot.on('logout', (user: ContactSelf) => {
console.log(`user ${user} logout`)
})
```
**Example** *(Event:message )*
```js
# Message Event will emit when there's a new message.
// Message Event will emit when there's a new message.

wechaty.on('message', (message: Message) => {
console.log(`message ${message} received`)
})
```
**Example** *(Event:friendship )*
```js
# Friendship Event will emit when got a new friend request, or friendship is confirmed.
// Friendship Event will emit when got a new friend request, or friendship is confirmed.

bot.on('friendship', (friendship: Friendship) => {
if(friendship.type() === Friendship.Type.RECEIVE){ // 1. receive new friendship request from new contact
Expand All @@ -131,7 +131,7 @@ bot.on('friendship', (friendship: Friendship) => {
```
**Example** *(Event:room-join )*
```js
# room-join Event will emit when someone join the room.
// room-join Event will emit when someone join the room.

bot.on('room-join', (room: Room, inviteeList: Contact[], inviter: Contact) => {
const nameList = inviteeList.map(c => c.name()).join(',')
Expand All @@ -140,7 +140,7 @@ bot.on('room-join', (room: Room, inviteeList: Contact[], inviter: Contact) => {
```
**Example** *(Event:room-leave )*
```js
# room-leave Event will emit when someone leave the room.
// room-leave Event will emit when someone leave the room.

bot.on('room-leave', (room: Room, leaverList: Contact[]) => {
const nameList = leaverList.map(c => c.name()).join(',')
Expand All @@ -149,15 +149,15 @@ bot.on('room-leave', (room: Room, leaverList: Contact[]) => {
```
**Example** *(Event:room-topic )*
```js
# room-topic Event will emit when someone change the room's topic.
// room-topic Event will emit when someone change the room's topic.

bot.on('room-topic', (room: Room, topic: string, oldTopic: string, changer: Contact) => {
console.log(`Room ${room.topic()} topic changed from ${oldTopic} to ${topic} by ${changer.name()}`)
})
```
**Example** *(Event:error )*
```js
# error Event will emit when there's an error occurred.
// error Event will emit when there's an error occurred.

bot.on('error', (error) => {
console.error(error)
Expand Down Expand Up @@ -245,7 +245,7 @@ Should use [userSelf](#WechatyuserSelf) instead

## wechaty.userSelf()

**Return the type of**: [<code>Contact</code>](/api/contact)
**Return the type of**: <code>ContactSelf</code>


Get current user
Expand Down Expand Up @@ -277,19 +277,19 @@ const bot = new Wechaty()
await bot.start()
// after logged in

# 1. send text to bot itself
// 1. send text to bot itself
await bot.say('hello!')

# 2. send Contact to bot itself
// 2. send Contact to bot itself
const contact = bot.Contact.load('contactId')
await bot.say(contact)

# 3. send Image to bot itself from remote url
// 3. send Image to bot itself from remote url
import { FileBox } from 'file-box'
const fileBox = FileBox.fromUrl('https://chatie.io/wechaty/images/bot-qr-code.png')
await bot.say(fileBox)

# 4. send Image to bot itself from local file
// 4. send Image to bot itself from local file
import { FileBox } from 'file-box'
const fileBox = FileBox.fromLocal('/tmp/text.jpg')
await bot.say(fileBox)
Expand Down
8 changes: 4 additions & 4 deletions docs/zh/api/README.md
Expand Up @@ -27,11 +27,11 @@ If you want to know how to get contact, see [Contact](/zh/api/contact)</p>
</dd>
<dt>[Room](/zh/api/room)</dt>
<dd><p>All wechat rooms(groups) will be encapsulated as a Room.</p>
<p><a href="https://github.com/Chatie/wechaty/blob/master/examples/room-bot.ts">Examples/Room-Bot</a></p>
<p><a href="https://github.com/Chatie/wechaty/blob/1523c5e02be46ebe2cc172a744b2fbe53351540e/examples/room-bot.ts">Examples/Room-Bot</a></p>
</dd>
<dt>[Contact](/zh/api/contact)</dt>
<dd><p>All wechat contacts(friend) will be encapsulated as a Contact.</p>
<p><a href="https://github.com/Chatie/wechaty/blob/master/examples/contact-bot.ts">Examples/Contact-Bot</a></p>
<p><a href="https://github.com/Chatie/wechaty/blob/1523c5e02be46ebe2cc172a744b2fbe53351540e/examples/contact-bot.ts">Examples/Contact-Bot</a></p>
</dd>
<dt>[Friendship](/zh/api/friendship)</dt>
<dd><p>Send, receive friend request, and friend confirmation events.</p>
Expand All @@ -40,11 +40,11 @@ If you want to know how to get contact, see [Contact](/zh/api/contact)</p>
<li>receive request(in friend event)</li>
<li>confirmation friendship(friend event)</li>
</ol>
<p><a href="https://github.com/Chatie/wechaty/blob/master/examples/friend-bot.ts">Examples/Friend-Bot</a></p>
<p><a href="https://github.com/Chatie/wechaty/blob/1523c5e02be46ebe2cc172a744b2fbe53351540e/examples/friend-bot.ts">Examples/Friend-Bot</a></p>
</dd>
<dt>[Message](/zh/api/message)</dt>
<dd><p>All wechat messages will be encapsulated as a Message.</p>
<p><a href="https://github.com/Chatie/wechaty/blob/master/examples/ding-dong-bot.ts">Examples/Ding-Dong-Bot</a></p>
<p><a href="https://github.com/Chatie/wechaty/blob/1523c5e02be46ebe2cc172a744b2fbe53351540e/examples/ding-dong-bot.ts">Examples/Ding-Dong-Bot</a></p>
</dd>
</dl>

Expand Down
10 changes: 5 additions & 5 deletions docs/zh/api/contact.md
@@ -1,7 +1,7 @@
# Contact类
All wechat contacts(friend) will be encapsulated as a Contact.

[Examples/Contact-Bot](https://github.com/Chatie/wechaty/blob/master/examples/contact-bot.ts)
[Examples/Contact-Bot](https://github.com/Chatie/wechaty/blob/1523c5e02be46ebe2cc172a744b2fbe53351540e/examples/contact-bot.ts)

**Kind**: global class

Expand Down Expand Up @@ -46,19 +46,19 @@ const bot = new Wechaty()
await bot.start()
const contact = await bot.Contact.find({name: 'lijiarui'}) // change 'lijiarui' to any of your contact name in wechat

# 1. send text to contact
// 1. send text to contact

await contact.say('welcome to wechaty!')

# 2. send media file to contact
// 2. send media file to contact

import { FileBox } from 'file-box'
const fileBox1 = FileBox.fromUrl('https://chatie.io/wechaty/images/bot-qr-code.png')
const fileBox2 = FileBox.fromLocal('/tmp/text.txt')
await contact.say(fileBox1)
await contact.say(fileBox2)

# 3. send contact card to contact
// 3. send contact card to contact

const contactCard = bot.Contact.load('contactId')
await contact.say(contactCard)
Expand Down Expand Up @@ -234,7 +234,7 @@ Get avatar picture file stream
**Kind**: instance method of [<code>Contact</code>](/zh/api/contact)
**Example**
```js
# Save avatar to local file like `1-name.jpg`
// Save avatar to local file like `1-name.jpg`
const file = await contact.avatar()
const name = file.name
Expand Down
6 changes: 3 additions & 3 deletions docs/zh/api/friendship.md
Expand Up @@ -5,7 +5,7 @@ Send, receive friend request, and friend confirmation events.
2. receive request(in friend event)
3. confirmation friendship(friend event)

[Examples/Friend-Bot](https://github.com/Chatie/wechaty/blob/master/examples/friend-bot.ts)
[Examples/Friend-Bot](https://github.com/Chatie/wechaty/blob/1523c5e02be46ebe2cc172a744b2fbe53351540e/examples/friend-bot.ts)

**Kind**: global class

Expand Down Expand Up @@ -37,13 +37,13 @@ bot.on('friendship', async friendship => {
console.log(`received friend event.`)
switch (friendship.type()) {

# 1. New Friend Request
// 1. New Friend Request

case Friendship.Type.Receive:
await friendship.accept()
break

# 2. Friend Ship Confirmed
// 2. Friend Ship Confirmed

case Friendship.Type.Confirm:
console.log(`friend ship confirmed`)
Expand Down

0 comments on commit a9a44ce

Please sign in to comment.