-
Notifications
You must be signed in to change notification settings - Fork 350
Aherman3 api docs add zh #1533
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
Open
aherman3
wants to merge
44
commits into
wechaty:main
Choose a base branch
from
aherman3:aherman3-api_docs_add_zh
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Aherman3 api docs add zh #1533
Changes from 37 commits
Commits
Show all changes
44 commits
Select commit
Hold shift + click to select a range
0e19067
add API docs Chinese version
aherman3 35657c5
Update docusaurus/i18n/zh/docusaurus-plugin-content-docs/current/api/…
aherman3 da09d62
Update docusaurus/i18n/zh/docusaurus-plugin-content-docs/current/api/…
aherman3 4f9ce94
Update docusaurus/i18n/zh/docusaurus-plugin-content-docs/current/api/…
aherman3 a901f51
Update docusaurus/i18n/zh/docusaurus-plugin-content-docs/current/api/…
aherman3 1d2322e
Update docusaurus/i18n/zh/docusaurus-plugin-content-docs/current/api/…
aherman3 017a7d6
Update docusaurus/i18n/zh/docusaurus-plugin-content-docs/current/api/…
aherman3 a4ae0bb
Update docusaurus/i18n/zh/docusaurus-plugin-content-docs/current/api/…
aherman3 b7f04ec
Update docusaurus/i18n/zh/docusaurus-plugin-content-docs/current/api/…
aherman3 a96b7d4
Update docusaurus/i18n/zh/docusaurus-plugin-content-docs/current/api/…
aherman3 15a2b3e
formatting fix
aherman3 92fc45b
0.11.8
aherman3 54d6dbe
merge
aherman3 19d4df1
0.11.9
aherman3 4390b64
fix internal links
aherman3 7ad16aa
0.11.10
aherman3 80ead80
Update contact-self.md
aherman3 49d91a1
Update contact-self.md
aherman3 17a45be
fix broken links
aherman3 7262d23
0.11.11
aherman3 c86eb07
overview broken link fix
aherman3 eb2274d
0.11.12
aherman3 2649dce
create branch
aherman3 dc407c1
0.11.13
aherman3 6eabdec
0.11.14
aherman3 6a81949
0.11.15
aherman3 e4e2628
0.11.16
aherman3 bc14031
0.11.17
aherman3 7a80e6d
remove references
aherman3 c4bedee
add api docs and change link references to relative
aherman3 d9e05e0
add api docs and change link references to relative
aherman3 23ef26c
0.11.18
aherman3 4fc424a
Delete yarn.lock
aherman3 9a8c394
Update package.json
aherman3 9ad74ee
Update package.json
aherman3 6d22588
Merge branch 'main' into aherman3-api_docs_add_zh
lijiarui 448cb6b
Update contact.md
aherman3 8597070
Update friendship.md
aherman3 24dea70
Update message.md
aherman3 9176fdd
Update room-invitation.md
aherman3 91afb11
Update contact-self.md
aherman3 d226568
Update contact.md
aherman3 43e4b87
Update docusaurus/i18n/zh/docusaurus-plugin-content-docs/current/api/…
aherman3 d37d836
Delete docusaurus/npm-debug.log
aherman3 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
104 changes: 104 additions & 0 deletions
104
docusaurus/i18n/zh/docusaurus-plugin-content-docs/current/api/contact-self.md
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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<FileBox>}\)_ | ||
|
||
```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) | ||
} | ||
}) | ||
``` |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.