Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Aherman3 api docs add zh #1533

Open
wants to merge 44 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 36 commits
Commits
Show all changes
44 commits
Select commit Hold shift + click to select a range
0e19067
add API docs Chinese version
aherman3 Mar 8, 2024
35657c5
Update docusaurus/i18n/zh/docusaurus-plugin-content-docs/current/api/…
aherman3 Mar 8, 2024
da09d62
Update docusaurus/i18n/zh/docusaurus-plugin-content-docs/current/api/…
aherman3 Mar 8, 2024
4f9ce94
Update docusaurus/i18n/zh/docusaurus-plugin-content-docs/current/api/…
aherman3 Mar 8, 2024
a901f51
Update docusaurus/i18n/zh/docusaurus-plugin-content-docs/current/api/…
aherman3 Mar 8, 2024
1d2322e
Update docusaurus/i18n/zh/docusaurus-plugin-content-docs/current/api/…
aherman3 Mar 8, 2024
017a7d6
Update docusaurus/i18n/zh/docusaurus-plugin-content-docs/current/api/…
aherman3 Mar 8, 2024
a4ae0bb
Update docusaurus/i18n/zh/docusaurus-plugin-content-docs/current/api/…
aherman3 Mar 8, 2024
b7f04ec
Update docusaurus/i18n/zh/docusaurus-plugin-content-docs/current/api/…
aherman3 Mar 8, 2024
a96b7d4
Update docusaurus/i18n/zh/docusaurus-plugin-content-docs/current/api/…
aherman3 Mar 8, 2024
15a2b3e
formatting fix
aherman3 Mar 8, 2024
92fc45b
0.11.8
aherman3 Mar 8, 2024
54d6dbe
merge
aherman3 Mar 8, 2024
19d4df1
0.11.9
aherman3 Mar 8, 2024
4390b64
fix internal links
aherman3 Mar 9, 2024
7ad16aa
0.11.10
aherman3 Mar 9, 2024
80ead80
Update contact-self.md
aherman3 Mar 9, 2024
49d91a1
Update contact-self.md
aherman3 Mar 9, 2024
17a45be
fix broken links
aherman3 Mar 9, 2024
7262d23
0.11.11
aherman3 Mar 9, 2024
c86eb07
overview broken link fix
aherman3 Mar 11, 2024
eb2274d
0.11.12
aherman3 Mar 11, 2024
2649dce
create branch
aherman3 Mar 11, 2024
dc407c1
0.11.13
aherman3 Mar 11, 2024
6eabdec
0.11.14
aherman3 Mar 11, 2024
6a81949
0.11.15
aherman3 Mar 11, 2024
e4e2628
0.11.16
aherman3 Mar 11, 2024
bc14031
0.11.17
aherman3 Mar 11, 2024
7a80e6d
remove references
aherman3 Mar 12, 2024
c4bedee
add api docs and change link references to relative
aherman3 Mar 14, 2024
d9e05e0
add api docs and change link references to relative
aherman3 Mar 14, 2024
23ef26c
0.11.18
aherman3 Mar 14, 2024
4fc424a
Delete yarn.lock
aherman3 Mar 14, 2024
9a8c394
Update package.json
aherman3 Mar 14, 2024
9ad74ee
Update package.json
aherman3 Mar 14, 2024
6d22588
Merge branch 'main' into aherman3-api_docs_add_zh
lijiarui Mar 25, 2024
448cb6b
Update contact.md
aherman3 Mar 26, 2024
8597070
Update friendship.md
aherman3 Mar 26, 2024
24dea70
Update message.md
aherman3 Mar 26, 2024
9176fdd
Update room-invitation.md
aherman3 Mar 26, 2024
91afb11
Update contact-self.md
aherman3 Mar 26, 2024
d226568
Update contact.md
aherman3 Mar 26, 2024
43e4b87
Update docusaurus/i18n/zh/docusaurus-plugin-content-docs/current/api/…
aherman3 Mar 26, 2024
d37d836
Delete docusaurus/npm-debug.log
aherman3 Mar 28, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion docusaurus/docs/references/overview.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ The reference guide contains the technical description of the machinery. They ar

## References Index

1. [API References](../api/overview.mdx)
aherman3 marked this conversation as resolved.
Show resolved Hide resolved
1. [API References](/api/overview.mdx)
1. [Polyglot](../polyglot/overview.mdx)
1. [Puppet Providers](../puppet-providers/overview.mdx)
1. [Puppet Services](../puppet-services/overview.mdx)
Expand Down
4 changes: 2 additions & 2 deletions docusaurus/docs/wechaty.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ Wechaty offers out-of-the-box support for the common features you would need for

:::note API References

Learn more functions from [API Reference](./api/overview.mdx) and [How-to Guides](./howto/overview.mdx).
Learn more functions from [API Reference](/api/overview.mdx) and [How-to Guides](/howto/overview.mdx).

:::

Expand Down Expand Up @@ -91,7 +91,7 @@ You can build a chatbot with a minimum of 6 lines of code with Wechaty.

:::note Polyglot Wechaty

Read more codes from [Polyglot](./polyglot/overview.mdx).
Read more codes from [Polyglot](/polyglot/overview.mdx).

:::

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,104 @@
---
title: ContactSelf
---

机器人自己的信息将会封装一个ContactSelf 类。这个类继承自 Contact。

## ContactSelf

> 备注:这个类继承自 Contact

**Kind**: global class

* ContactSelf
* 实例
* contactSelf.avatar\(\[file\]\) ⇒ `Promise <void | FileBox>`
* contactSelf.qrcode\(\) ⇒ `Promise <string>`
* contactSelf.signature\(signature\) ⇒ `Promise <string>`
* contactSelf.name\(\[name\]\) ⇒ `Promise <void> | string`

### contactSelf.avatar\(\[file\]\) ⇒ `Promise <void | FileBox>`

设置机器人的头像

**Kind**: `ContactSelf`的实例方法

| Param | Type |
| :--- | :--- |
| \[file\] | `FileBox` |

**示例** _\( GET the avatar for bot, return {Promise&lt;FileBox&gt;}\)_

```javascript
bot.on('login', async user => {
console.log(`user ${user} login`)
const file = await user.avatar()
const name = file.name
await file.toFile(name, true)
console.log(`Save bot avatar: ${user.name()} with avatar file: ${name}`)
})

### contactSelf.qrcode\(\) ⇒ `Promise <string>`

获取机器人的二维码。

**Kind**: `ContactSelf`的实例方法

#### 示例

```javascript
import { generate } from 'qrcode-terminal'
bot.on('login', async user => {
console.log(`user ${user} login`)
const qrcode = await user.qrcode()
console.log(`Following is the bot qrcode!`)
generate(qrcode, { small: true })
})
```

### contactSelf.signature\(signature\) ⇒ `Promise <void>`

修改机器人签名。

**Kind**: `ContactSelf`的实例方法

| Param | Description |
| :--- | :--- |
| signature | 机器人要修改的签名内容 |

#### 示例

```javascript
bot.on('login', async user => {
console.log(`user ${user} login`)
try {
await user.signature(`Signature changed by wechaty on ${new Date()}`)
} catch (e) {
console.error('change signature failed', e)
}
})
```

### contactSelf.name\(\[name\]\) ⇒ `Promise<void> | string`

修改机器人昵称。

**Kind**: `ContactSelf`的实例方法

| Param | Description |
| :--- | :--- |
| \[name\] | 机器人要修改的昵称内容 |

#### 示例

```javascript
bot.on('login', async user => {
console.log(`user ${user} login`)
const oldName = user.name() // get bot name
try {
await user.name(`${oldName}-${new Date().getTime()}`) // change bot name
} catch (e) {
console.error('change name failed', e)
}
})
```
Loading
Loading