-
Notifications
You must be signed in to change notification settings - Fork 346
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
add API docs Chinese version #1530
Closed
Closed
Changes from all commits
Commits
Show all changes
20 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 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
104 changes: 104 additions & 0 deletions
104
docusaurus/i18n/zh/docusaurus-plugin-content-docs/current/api/contact-self.md
This file contains 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.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The documentation for instance methods (
avatar
,qrcode
,signature
,name
) is well-structured, providing method signatures and return types. This structure aids in quick comprehension of what each method does. However, ensure consistency in the documentation style for return types. For example,Promise <void | FileBox>
andPromise<void> | string
have slightly different spacing around the|
symbol. Consistency in such details improves readability.Committable suggestion