-
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
Conversation
WalkthroughThe documentation update enriches the Wechaty API documentation with detailed information on classes like Changes
Related issues
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (invoked as PR comments)
Additionally, you can add CodeRabbit Configration File (
|
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.
Review Status
Actionable comments generated: 10
Configuration used: CodeRabbit UI
Files selected for processing (9)
- docusaurus/i18n/zh/docusaurus-plugin-content-docs/current/api/contact-self.md (1 hunks)
- docusaurus/i18n/zh/docusaurus-plugin-content-docs/current/api/contact.md (1 hunks)
- docusaurus/i18n/zh/docusaurus-plugin-content-docs/current/api/friendship.md (1 hunks)
- docusaurus/i18n/zh/docusaurus-plugin-content-docs/current/api/message.md (1 hunks)
- docusaurus/i18n/zh/docusaurus-plugin-content-docs/current/api/overview.mdx (1 hunks)
- docusaurus/i18n/zh/docusaurus-plugin-content-docs/current/api/room-invitation.md (1 hunks)
- docusaurus/i18n/zh/docusaurus-plugin-content-docs/current/api/room.md (1 hunks)
- docusaurus/i18n/zh/docusaurus-plugin-content-docs/current/api/wechaty-class.md (1 hunks)
- docusaurus/i18n/zh/docusaurus-plugin-content-docs/current/api/wechaty.md (1 hunks)
Additional comments: 33
docusaurus/i18n/zh/docusaurus-plugin-content-docs/current/api/room-invitation.md (1)
- 74-74: The explanation of the
age()
method's value calculation is clear, but it might be beneficial to clarify that the example provided is hypothetical and that actual values will vary depending on the specific circumstances of the invitation and reception times.Consider adding a note to clarify that the times and the calculated age in the example are illustrative and that actual values will depend on the specific situation.
docusaurus/i18n/zh/docusaurus-plugin-content-docs/current/api/friendship.md (9)
- 5-5: The introduction provides a clear overview of the
Friendship
class. However, it would be beneficial to briefly mention the significance of this class in the context of the Wechaty framework to provide readers with a better understanding of its role.- 7-7: The link to the example
friend-bot.ts
is a valuable resource for developers. Ensure that this link is kept up-to-date with the repository's structure to prevent any broken links in the future.Verification successful
The verification process confirms that the link to the example
friend-bot.ts
in the Wechaty repository is valid and points to an existing resource. The link is up-to-date and not broken, ensuring developers have access to the referenced example.* 11-15: The classification of friendship requests into three categories is clear and concise. It might be helpful to provide a brief description or example for each category to enhance understanding. * 32-62: The example code provided for `friendship.accept()` is clear and demonstrates the method's usage effectively. However, ensure that the comments within the code are also translated to maintain consistency with the document's language. * 64-83: Similar to the previous comment, the example for `friendship.hello()` is informative. Again, translating comments within the code block would improve consistency and accessibility for Chinese-speaking developers. * 85-99: The example for `friendship.contact()` is concise and demonstrates the method's usage well. As before, translating comments within the code block to Chinese would enhance the document's consistency. * 101-126: The example illustrating the use of `friendship.type()` is helpful. Ensure that all comments within the code are translated to maintain the document's language consistency. * 128-144: The method `Friendship.search(phone)` is described with a cautionary note on usage frequency, which is important for preventing account suspension. This is a good practice, and it's recommended to highlight such best practices more prominently to ensure they are not overlooked by developers. * 146-188: The examples provided for `Friendship.add(contact, options)` are diverse and cover different scenarios. It's crucial to ensure that all comments within these code blocks are translated into Chinese to maintain the document's overall language consistency.Scripts Executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Verify the existence of the example file in the repository curl -o /dev/null --silent --head --write-out '%{http_code}\n' https://github.com/wechaty/wechaty/blob/1523c5e02be46ebe2cc172a744b2fbe53351540e/examples/friend-bot.ts | grep 200Length of output: 183
docusaurus/i18n/zh/docusaurus-plugin-content-docs/current/api/contact.md (1)
- 53-53: The documentation for the
say
method's parameter types includes "FileBox", "UrlLink", and "MiniProgram". Ensure that these types are correctly referenced and that their usage is consistent throughout the documentation. Additionally, consider using code blocks for type names to improve readability.Please verify that "FileBox", "UrlLink", and "MiniProgram" are correctly referenced and consistently used throughout the documentation. Consider enclosing type names in code blocks for improved readability.
docusaurus/i18n/zh/docusaurus-plugin-content-docs/current/api/message.md (12)
- 1-3: The metadata section correctly defines the title for the document. However, ensure consistency in metadata across all documentation files for uniformity.
- 4-4: The introduction provides a clear overview of the
Message
class. It's concise and informative, setting a good context for the rest of the document.- 6-6: Including an example link (
Examples/Ding-Dong-Bot
) at the beginning is a good practice as it gives readers a practical reference. Ensure the link is up-to-date and points to the correct branch or tag to avoid confusion.Verification successful
The corrected script successfully verified that the provided link is valid, as indicated by the HTTP/2 200 status code in the output. This confirms that the link points to an existing resource on the GitHub repository for the Wechaty project.
* 8-28: The table listing instance methods is well-organized and provides a quick overview of the available methods. However, consider adding a brief description column to the table for each method to enhance understanding at a glance without needing to read detailed descriptions later in the document. * 30-35: The static methods section is concise. Similar to the instance methods, adding a brief description for each static method in the table could provide more clarity to the reader. * 39-61: The example provided for `message.from()` is clear and demonstrates the method's usage effectively. Ensure all examples are tested to work with the latest version of Wechaty to maintain the documentation's accuracy. * 132-148: The example for `message.toRecalled()` is a good addition, showcasing a more advanced feature. It's important to clarify the context in which a message can be recalled and whether this feature is supported across all platforms Wechaty operates on. * 150-229: The detailed examples for `message.say()` covering different message types (text, contact, file, URL link, mini-program) are excellent. They provide a comprehensive guide to interacting with the API. Ensure that all examples are compatible with the current API and that any platform-specific features are clearly marked. * 231-246: The explanation of message types under `message.type()` is succinct and informative. It might be beneficial to provide a bit more context or examples on how different message types can be used in practice, especially for types like `MessageType.Attachment`, `MessageType.Audio`, etc., to give developers a clearer understanding of their applications. * 269-298: The sections on `message.mention()` and `message.mentionSelf()` are particularly useful for bot interactions in group chats. It's good practice to include notes or warnings about any limitations or peculiarities in detecting mentions across different platforms (Web, Mac PC Client, iOS Mobile, Android Mobile) as mentioned in the table. This helps set the right expectations for developers. * 300-321: The example for `message.forward(to)` is straightforward and demonstrates the method's utility well. It's important to note any restrictions or prerequisites for forwarding messages, such as permissions or message types that can be forwarded, to provide a complete picture to the reader. * 327-331: The explanation of `message.age()` provides a practical example of its use. It might be helpful to include a note on the precision and accuracy of this method, especially if there are any known discrepancies or limitations in the timing information provided by different platforms or network conditions.Scripts Executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Verify if the provided link is valid and points to the correct branch or tag curl -I https://github.com/wechaty/wechaty/blob/1523c5e02be46ebe2cc172a744b2fbe53351540e/examples/ding-dong-bot.ts | grep HTTP/2 200Length of output: 519
Script:
#!/bin/bash # Corrected script to verify if the provided link is valid and points to the correct branch or tag curl -I https://github.com/wechaty/wechaty/blob/1523c5e02be46ebe2cc172a744b2fbe53351540e/examples/ding-dong-bot.ts | grep "HTTP/2 200"Length of output: 465
docusaurus/i18n/zh/docusaurus-plugin-content-docs/current/api/wechaty.md (5)
- 5-15: In the introduction and the Classes section, there's a consistent misspelling of "WeChat" as "微信". While "微信" is the Chinese name for WeChat, it might be more appropriate to use "WeChat" in this context to maintain consistency with the global naming convention, especially when referring to technical implementations like "Puppet-Puppeteer" or "Puppet-wechat4u". Consider revising to ensure clarity and consistency for readers who might be looking for specific technical terms.
- 308-313: The PuppetName section provides a good overview of what Puppets are and lists examples. However, it's important to ensure that all external links are up-to-date and accessible. Given the dynamic nature of GitHub repositories, it's advisable to periodically verify these links to ensure they still point to the intended resources. This helps maintain the documentation's reliability and usefulness for developers.
- 325-337: The WechatyOptions section clearly outlines the available options for creating a Wechaty instance. However, it's crucial to ensure that all options are thoroughly explained, especially for options like
puppetOptions
andioToken
, which might require more context for new users. Providing examples or more detailed descriptions for complex options can significantly improve the documentation's usability.- 339-359: The WechatyEventName section does an excellent job of listing and describing the events that a Wechaty instance can emit. To further enhance this section, consider adding practical examples for each event type. This would not only clarify the use cases for each event but also assist developers in understanding how to effectively implement event handling in their Wechaty bots.
- 361-381: In the WechatyEventFunction section, while the functions are well-documented, it's important to ensure that the documentation remains accessible to developers of all levels. Consider adding more detailed explanations or examples for the callback functions, especially for those that involve more complex interactions like
room-join
,room-leave
, androom-invite
. This could help developers better understand how to utilize these events in their applications.docusaurus/i18n/zh/docusaurus-plugin-content-docs/current/api/room.md (5)
- 26-26: The method signature for
say
includes a mix of Chinese and English, which might be confusing. Consider using English for code elements (e.g.,text
,Contact
,File
,UrlLink
,MiniProgram
,...mentionList
) for clarity and consistency with programming standards.Consider revising the method signature to maintain clarity and consistency with programming standards.
- 59-59: The method name
room.say
and its parameters are mixed with Chinese characters, which could lead to confusion. It's recommended to keep code elements in English for consistency and to avoid potential issues with code parsing or understanding.Suggest revising the method signature to use English exclusively for code elements.
- 70-129: The code examples provided are very helpful for understanding how to use the
Room
class. However, ensure that all external links (e.g., toFileBox
) and references to specific puppets (e.g.,wechaty-puppet-macpro
) are up-to-date and accessible. Additionally, consider adding comments within the code examples to explain key steps or decisions for better clarity.Verification successful
The verification process has confirmed that both external links mentioned in the review comment, specifically to
FileBox
andwechaty-puppet-macpro
on npmjs.com, are accessible, as indicated by the HTTP status code 200 for both URLs. This suggests that the external links provided in the code examples are up-to-date and accessible. However, the review comment also suggested adding comments within the code examples for better clarity, which cannot be verified through script execution and requires manual inspection of the code or documentation.Given the information obtained, the external links are verified to be correct. For the suggestion regarding adding comments for clarity, it remains a qualitative aspect that needs to be addressed by the document's maintainers or contributors.
* 131-194: The event handling examples (`room.on`) demonstrate various scenarios (e.g., `join`, `leave`, `topic`, `invite`). It's important to ensure that these examples are aligned with the latest API capabilities and accurately reflect the current behavior of the Wechaty framework.Scripts Executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Verify that external links are accessible curl -o /dev/null --silent --head --write-out '%{http_code}\n' https://www.npmjs.com/package/file-box # Expected output: 200Length of output: 107
Script:
#!/bin/bash # Verify that the reference to `wechaty-puppet-macpro` is up-to-date and accessible curl -o /dev/null --silent --head --write-out '%{http_code}\n' https://www.npmjs.com/package/wechaty-puppet-macpro # Expected output: 200Length of output: 120
Consider verifying that the event handling examples are up-to-date and accurately reflect the current capabilities of the Wechaty framework.
- 545-589: The typedef sections (
RoomQueryFilter
,RoomEventName
,RoomEventFunction
,RoomMemberQueryFilter
) provide valuable information for understanding the types and structures used within theRoom
class. Ensure that these typedefs are complete and accurately documented. Additionally, consider linking to more detailed documentation or examples for complex types or behaviors.Review the completeness and accuracy of the typedef documentation. Consider linking to more detailed documentation where applicable.
docusaurus/i18n/zh/docusaurus-plugin-content-docs/current/api/friendship.md
Outdated
Show resolved
Hide resolved
docusaurus/i18n/zh/docusaurus-plugin-content-docs/current/api/wechaty-class.md
Outdated
Show resolved
Hide resolved
docusaurus/i18n/zh/docusaurus-plugin-content-docs/current/api/friendship.md
Outdated
Show resolved
Hide resolved
docusaurus/i18n/zh/docusaurus-plugin-content-docs/current/api/contact.md
Outdated
Show resolved
Hide resolved
docusaurus/i18n/zh/docusaurus-plugin-content-docs/current/api/overview.mdx
Show resolved
Hide resolved
docusaurus/i18n/zh/docusaurus-plugin-content-docs/current/api/contact.md
Outdated
Show resolved
Hide resolved
docusaurus/i18n/zh/docusaurus-plugin-content-docs/current/api/contact.md
Outdated
Show resolved
Hide resolved
docusaurus/i18n/zh/docusaurus-plugin-content-docs/current/api/contact-self.md
Outdated
Show resolved
Hide resolved
docusaurus/i18n/zh/docusaurus-plugin-content-docs/current/api/contact.md
Outdated
Show resolved
Hide resolved
docusaurus/i18n/zh/docusaurus-plugin-content-docs/current/api/room.md
Outdated
Show resolved
Hide resolved
…room.md Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
…friendship.md Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
…wechaty-class.md Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
…friendship.md Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
…contact.md Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
…contact.md Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
…contact.md Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
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.
Review Status
Actionable comments generated: 2
Configuration used: CodeRabbit UI
Files selected for processing (1)
- docusaurus/i18n/zh/docusaurus-plugin-content-docs/current/api/room.md (1 hunks)
Additional comments: 4
docusaurus/i18n/zh/docusaurus-plugin-content-docs/current/api/room.md (4)
- 26-26: The method signature for
say
includes a mix of Chinese and English, which might be confusing. Consider using English for code elements (e.g.,text
,Contact
,File
,UrlLink
,MiniProgram
) and Chinese for descriptions to maintain clarity.Consider revising the method signature to clearly distinguish between code elements and their descriptions.
- 59-59: The method name
say
and its parameters are mixed with Chinese characters, which could lead to confusion. It's recommended to keep code elements in English for consistency and clarity.Consider revising the method signature to use English for code elements and Chinese for descriptions.
- 70-70: There's an extra space before the closing parenthesis in the markdown code block, which might lead to formatting issues.
Remove the extra space before the closing parenthesis to ensure proper markdown formatting.
- 589-589: There's an extra space before the period in the markdown link, which might lead to formatting issues.
Remove the extra space before the period to ensure proper markdown formatting.
docusaurus/i18n/zh/docusaurus-plugin-content-docs/current/api/room.md
Outdated
Show resolved
Hide resolved
…contact-self.md Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
…contact.md Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
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.
Review Status
Actionable comments generated: 10
Configuration used: CodeRabbit UI
Files ignored due to path filters (1)
package.json
is excluded by:!**/*.json
Files selected for processing (9)
- docusaurus/docs/api/contact-self.md (4 hunks)
- docusaurus/i18n/zh/docusaurus-plugin-content-docs/current/api/contact-self.md (1 hunks)
- docusaurus/i18n/zh/docusaurus-plugin-content-docs/current/api/contact.md (1 hunks)
- docusaurus/i18n/zh/docusaurus-plugin-content-docs/current/api/friendship.md (1 hunks)
- docusaurus/i18n/zh/docusaurus-plugin-content-docs/current/api/message.md (1 hunks)
- docusaurus/i18n/zh/docusaurus-plugin-content-docs/current/api/room-invitation.md (1 hunks)
- docusaurus/i18n/zh/docusaurus-plugin-content-docs/current/api/room.md (1 hunks)
- docusaurus/i18n/zh/docusaurus-plugin-content-docs/current/api/wechaty-class.md (1 hunks)
- docusaurus/i18n/zh/docusaurus-plugin-content-docs/current/api/wechaty.md (1 hunks)
Files not reviewed due to errors (1)
- (no review received)
Additional comments: 20
docusaurus/i18n/zh/docusaurus-plugin-content-docs/current/api/wechaty-class.md (1)
- 15-15: The link to the Puppet explanation is correctly formatted and provides valuable context for understanding Wechaty's architecture.
docusaurus/i18n/zh/docusaurus-plugin-content-docs/current/api/room-invitation.md (1)
- 17-17: Ensure that the examples provided are clear and demonstrate the intended usage of the
roomInvitation.accept()
method effectively.docusaurus/docs/api/contact-self.md (1)
- 16-16: The update to the link paths ensures that navigation within the documentation is correct and users can easily access the referenced entities.
docusaurus/i18n/zh/docusaurus-plugin-content-docs/current/api/friendship.md (10)
- 5-5: The introduction provides a clear overview of the
Friendship
class. However, it could be enhanced by briefly mentioning the significance of this class in the context of the Wechaty framework, such as how it facilitates the management of friend requests within WeChat bots.- 7-7: The link to the example is helpful for developers to see a practical implementation. Ensure that the linked example is up-to-date and accurately demonstrates the use of the
Friendship
class as described in this documentation.- 11-15: The summary of the
Friendship
class functionalities is concise and informative. It might be beneficial to include a brief explanation or example for each of the three functionalities listed to provide readers with a clearer understanding of their use cases.- 19-25: The table format for instance methods is clear and easy to read. However, ensure that the descriptions for each method are comprehensive and provide enough detail for developers to understand the method's purpose without needing to refer to additional resources.
- 28-30: Similar to the instance methods, the static methods table is well-structured. It would be beneficial to include examples or more detailed descriptions for the static methods, especially for
add()
, to illustrate its usage in different scenarios.- 32-62: The code example under
friendship.accept()
is clear and demonstrates the method's usage effectively. Consider adding a brief explanation before the code snippet to describe what the example aims to achieve, enhancing the documentation's clarity.- 64-83: The example for
friendship.hello()
is practical and demonstrates the method's usage well. It's recommended to briefly explain the significance of thehello
message in the context of accepting friend requests, providing readers with a better understanding of its role.- 85-99: The example for
friendship.contact()
effectively shows how to retrieve the contact who sent the friend request. Adding a note on potential use cases for this method, such as logging or further processing, could provide additional context for readers.- 101-126: The example under
friendship.type()
is straightforward and illustrates how to use the method to filter friend requests. Clarifying the differentFriendshipType
values and their meanings would enhance the reader's comprehension of how to effectively use this method.- 146-189: The examples for
Friendship.add(contact, options)
are comprehensive, covering different scenarios. It would be helpful to include a brief explanation of theoptions
parameter, especially thehello
message's role and how it can be customized for different contexts.docusaurus/i18n/zh/docusaurus-plugin-content-docs/current/api/message.md (3)
- 1-3: The metadata section is correctly formatted and provides the necessary information for the document.
- 4-8: The introduction to the
Message
class is clear and concise, effectively setting the context for the rest of the document.- 39-356: The examples provided are well-structured and demonstrate the usage of the
Message
class effectively. However, there are minor grammatical issues and unnecessary spaces before closing parentheses in some code snippets. These are minor issues but correcting them can improve the document's quality.Consider removing unnecessary spaces before closing parentheses and reviewing the document for minor grammatical corrections.
docusaurus/i18n/zh/docusaurus-plugin-content-docs/current/api/wechaty.md (1)
- 250-250: The description for the
say
method includes multiple types for the parametertextOrContactOrFileOrUrl
. Ensure that the documentation clearly explains how each type is handled, especially forFileBox
andUrlLink
, to avoid confusion.Consider adding more detailed examples or explanations for each parameter type to ensure clarity.
docusaurus/i18n/zh/docusaurus-plugin-content-docs/current/api/room.md (3)
- 23-39: In the instance methods section, there's an inconsistency with spacing in the markdown table that might affect the rendering of the documentation. Ensure that there are no unnecessary spaces or missing spaces between the pipes (
|
) to maintain a clean and professional appearance in the documentation.Consider reviewing the markdown formatting to ensure consistent spacing within tables for better readability and rendering.
- 59-129: The examples provided for the
room.say
method are comprehensive and cover various use cases. However, it's important to ensure that all external links, such as those toFileBox
, are up-to-date and accessible. Additionally, consider adding comments within the code snippets to explain the purpose of each step, enhancing clarity for readers who may be new to Wechaty or chatbot development.Ensure external links in examples are current and accessible, and consider adding explanatory comments within code snippets for enhanced clarity.
- 487-507: In the static method
Room.create
, the example provided is useful but could benefit from a brief explanation of the scenario it represents. Adding a sentence or two to describe the context in which this method might be used can help developers understand its practical applications more clearly.Consider adding a brief explanation of the scenario represented by the
Room.create
method example to help developers understand its practical applications.
| 实例方法 | 返回类型 | | ||
|--------------------------------|---------------------| | ||
| from\(\) | `Contact` 或 `null` | | ||
| to\(\) | `Contact` 或 `null` | | ||
| room\(\) | `Room` 或 `null` | | ||
| text\(\) | `string` | | ||
| say\(text Or Contact Or File\) | `Promise` | | ||
| type\(\) | `MessageType` | | ||
| self\(\) | `boolean` | | ||
| mention\(\) | `Promise` | | ||
| mentionSelf\(\) | `Promise` | | ||
| forward\(to\) | `Promise` | | ||
| date\(\) | `Date` | | ||
| age\(\) | `Number` | | ||
| toFileBox\(\) | `Promise` | | ||
| toContact\(\) | `Promise` | | ||
| toUrlLink\(\) | `Promise` | |
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.
There are repeated whitespaces in the instance methods table that could be removed for better readability. This is a minor formatting issue but improving it can enhance the document's overall presentation.
- | 实例方法 | 返回类型 |
+ | 实例方法 | 返回类型 |
Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation.
| 实例方法 | 返回类型 | | |
|--------------------------------|---------------------| | |
| from\(\) | `Contact` 或 `null` | | |
| to\(\) | `Contact` 或 `null` | | |
| room\(\) | `Room` 或 `null` | | |
| text\(\) | `string` | | |
| say\(text Or Contact Or File\) | `Promise` | | |
| type\(\) | `MessageType` | | |
| self\(\) | `boolean` | | |
| mention\(\) | `Promise` | | |
| mentionSelf\(\) | `Promise` | | |
| forward\(to\) | `Promise` | | |
| date\(\) | `Date` | | |
| age\(\) | `Number` | | |
| toFileBox\(\) | `Promise` | | |
| toContact\(\) | `Promise` | | |
| toUrlLink\(\) | `Promise` | | |
| 实例方法 | 返回类型 | | |
|--------------------------------|---------------------| | |
| from\(\) | `Contact` 或 `null` | | |
| to\(\) | `Contact` 或 `null` | | |
| room\(\) | `Room` 或 `null` | | |
| text\(\) | `string` | | |
| say\(text Or Contact Or File\) | `Promise` | | |
| type\(\) | `MessageType` | | |
| self\(\) | `boolean` | | |
| mention\(\) | `Promise` | | |
| mentionSelf\(\) | `Promise` | | |
| forward\(to\) | `Promise` | | |
| date\(\) | `Date` | | |
| age\(\) | `Number` | | |
| toFileBox\(\) | `Promise` | | |
| toContact\(\) | `Promise` | | |
| toUrlLink\(\) | `Promise` | |
|
||
一个Wechaty Bot 代表着一个微信的客户端,他取决于你具体使用哪一个Puppet。 | ||
|
||
* **web-WeChat** - 当使用Puppet-Puppeteer 或 Puppet-wechat4u |
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.
Consider removing the extra whitespace between "Puppet-Puppeteer" and "Puppet-wechat4u" for consistency and readability.
- * **web-WeChat** - 当使用Puppet-Puppeteer 或 Puppet-wechat4u
+ * **web-WeChat** - 当使用Puppet-Puppeteer 或 Puppet-wechat4u
Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation.
* **web-WeChat** - 当使用Puppet-Puppeteer 或 Puppet-wechat4u | |
* **web-WeChat** - 当使用Puppet-Puppeteer 或 Puppet-wechat4u |
* [new Wechaty\(\[options\]\)](/zh/docs/api/wechaty.md#new_Wechaty_new) | ||
* _instance_ | ||
* [.on\(event, listener\)](/zh/docs/api/wechaty.md#Wechaty+on) ⇒ [`Wechaty`](/zh/docs/api/wechaty.md#Wechaty) | ||
* [.start\(\)](/zh/docs/api//zh/docs/api/wechaty.md#Wechaty+start) ⇒ `Promise <void>` |
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.
There's a typo in the URL for the .start()
method documentation link. It contains an extra /zh/docs/api/
segment.
- * [.start\(\)](/zh/docs/api//zh/docs/api/wechaty.md#Wechaty+start) ⇒ `Promise <void>`
+ * [.start\(\)](/zh/docs/api/wechaty.md#Wechaty+start) ⇒ `Promise <void>`
Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation.
* [.start\(\)](/zh/docs/api//zh/docs/api/wechaty.md#Wechaty+start) ⇒ `Promise <void>` | |
* [.start\(\)](/zh/docs/api/wechaty.md#Wechaty+start) ⇒ `Promise <void>` |
**Kind**: global class | ||
|
||
* [ContactSelf](/zh/docs/api/contact-self.md#contactself) | ||
* [intance](/zh/docs/api/contact-self.md#contactself) |
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.
There's a typo in the word "instance" (written as "intance"). Correcting this typo will improve the documentation's accuracy.
- * [intance](/zh/docs/api/contact-self.md#contactself)
+ * [instance](/zh/docs/api/contact-self.md#contactself)
Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation.
* [intance](/zh/docs/api/contact-self.md#contactself) | |
* [instance](/zh/docs/api/contact-self.md#contactself) |
### 静态方法 | ||
|
||
| 静态方法 | 返回类型 | | ||
|----------------|-------------| | ||
| find\(\) | `Promise` | | ||
| findAll\(\) | `Promise` | |
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.
Similar to the instance methods table, the static methods table also contains unnecessary whitespaces that could be removed to improve readability.
- | 静态方法 | 返回类型 |
+ | 静态方法 | 返回类型 |
Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation.
### 静态方法 | |
| 静态方法 | 返回类型 | | |
|----------------|-------------| | |
| find\(\) | `Promise` | | |
| findAll\(\) | `Promise` | | |
### 静态方法 | |
| 静态方法 | 返回类型 | | |
|----------------|-------------| | |
| find\(\) | `Promise` | | |
| findAll\(\) | `Promise` | |
### Friendship.search\(phone\) ⇒ `Promise <Contact>` | ||
|
||
该方法通过电话号码搜索联系人并获取联系人。 | ||
> 最佳实践:每分钟加1次,如果发送的过于频繁,你可能会被封号,每天能添加的好友数量是有上限的。 | ||
|
||
| Param | Type | Description | | ||
| :--- | :--- | :--- | | ||
| phone | `number` | 搜索电话号码 | | ||
|
||
#### 示例 | ||
|
||
```javascript | ||
const phone = '131xxx1234' | ||
const searchContact = await bot.Friendship.search({ | ||
phone, | ||
}) | ||
``` |
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 Friendship.search(phone)
method's documentation is clear about its functionality. Highlighting the importance of rate limiting and the potential consequences of exceeding the limits would be beneficial for developers to understand the importance of adhering to best practices.
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.
Review Status
Actionable comments generated: 1
Configuration used: CodeRabbit UI
Files selected for processing (1)
- docusaurus/docs/api/contact-self.md (4 hunks)
Additional comments: 1
docusaurus/docs/api/contact-self.md (1)
- 26-26: It's great to see detailed documentation for each method of the
ContactSelf
class. The inclusion of examples is particularly helpful for developers to understand how to use these methods in practice.One minor suggestion for improvement is to ensure consistency in the formatting of the documentation. For example, the method descriptions and examples should consistently use a specific style for better readability. This includes consistent use of capitalization, punctuation, and spacing around code blocks.
Consider reviewing the documentation to ensure consistent formatting throughout. This could involve standardizing the presentation of method descriptions, parameters, and examples.
docusaurus/docs/api/contact-self.md
Outdated
* [ContactSelf](/zh/docs/api/contact-self.md#contactself) | ||
* [intance](/zh/docs/api/contact-self.md#contactself) | ||
* [contactSelf.avatar\(\[file\]\) ⇒ `Promise <void | FileBox>`](/zh/docs/api/contact-self.md#contactselfavatarfile-⇒-promise) | ||
* [contactSelf.qrcode\(\) ⇒ `Promise <string>`](/zh/docs/api/contact-self.md#contactselfqrcode-⇒-promise) | ||
* [contactSelf.signature\(signature\) ⇒ `Promise <string>`](/zh/docs/api/contact-self.md#contactselfsignaturesignature) | ||
* [contactSelf.name\(\[name\]\) ⇒ `Promise <void> | string`](/zh/docs/api/contact-self.md#contactselfname-⇒-promisestring) |
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 updates to the links for ContactSelf
and its methods to include the full path /docusaurus/i18n/zh/docusaurus-plugin-content-docs/current/api/
are a significant improvement for navigation within the documentation. This ensures that users are directed to the correct version of the documentation based on their language preference.
However, there's a typo in the word "instance" on line 16, which is currently spelled as "intance". Correcting this typo will improve the readability and professionalism of the documentation.
- * [intance](/zh/docs/api/contact-self.md#contactself)
+ * [instance](/zh/docs/api/contact-self.md#contactself)
Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation.
* [ContactSelf](/zh/docs/api/contact-self.md#contactself) | |
* [intance](/zh/docs/api/contact-self.md#contactself) | |
* [contactSelf.avatar\(\[file\]\) ⇒ `Promise <void | FileBox>`](/zh/docs/api/contact-self.md#contactselfavatarfile-⇒-promise) | |
* [contactSelf.qrcode\(\) ⇒ `Promise <string>`](/zh/docs/api/contact-self.md#contactselfqrcode-⇒-promise) | |
* [contactSelf.signature\(signature\) ⇒ `Promise <string>`](/zh/docs/api/contact-self.md#contactselfsignaturesignature) | |
* [contactSelf.name\(\[name\]\) ⇒ `Promise <void> | string`](/zh/docs/api/contact-self.md#contactselfname-⇒-promisestring) | |
* [ContactSelf](/zh/docs/api/contact-self.md#contactself) | |
* [instance](/zh/docs/api/contact-self.md#contactself) | |
* [contactSelf.avatar\(\[file\]\) ⇒ `Promise <void | FileBox>`](/zh/docs/api/contact-self.md#contactselfavatarfile-⇒-promise) | |
* [contactSelf.qrcode\(\) ⇒ `Promise <string>`](/zh/docs/api/contact-self.md#contactselfqrcode-⇒-promise) | |
* [contactSelf.signature\(signature\) ⇒ `Promise <string>`](/zh/docs/api/contact-self.md#contactselfsignaturesignature) | |
* [contactSelf.name\(\[name\]\) ⇒ `Promise <void> | string`](/zh/docs/api/contact-self.md#contactselfname-⇒-promisestring) |
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.
Review Status
Actionable comments generated: 5
Configuration used: CodeRabbit UI
Files ignored due to path filters (1)
package.json
is excluded by:!**/*.json
Files selected for processing (4)
- docusaurus/i18n/zh/docusaurus-plugin-content-docs/current/api/contact-self.md (1 hunks)
- docusaurus/i18n/zh/docusaurus-plugin-content-docs/current/api/contact.md (1 hunks)
- docusaurus/i18n/zh/docusaurus-plugin-content-docs/current/api/room.md (1 hunks)
- docusaurus/i18n/zh/docusaurus-plugin-content-docs/current/api/wechaty.md (1 hunks)
Additional comments: 27
docusaurus/i18n/zh/docusaurus-plugin-content-docs/current/api/contact-self.md (6)
- 1-3: The document title and metadata are correctly formatted. However, the static analysis tool suggested a possible spelling mistake with "ContactSelf". This is a false positive since "ContactSelf" is the correct class name in the context of the Wechaty API documentation.
- 5-9: The introduction provides a clear overview of the
ContactSelf
class, correctly noting that it inherits from theContact
class. This is a good practice for API documentation as it sets the context for the reader. The remark about inheritance is also helpful for understanding the relationship between classes.- 20-39: The example provided for the
avatar
method is clear and demonstrates how to retrieve and save the bot's avatar. This is a good practice in API documentation as it helps developers understand how to use the method in a practical scenario. However, the static analysis tool flagged a possible spelling mistake with "FileBox". This is a false positive since "FileBox" is a specific type used in the Wechaty framework.- 41-57: The example for the
qrcode
method is concise and demonstrates the method's usage effectively. Usingqrcode-terminal
to generate a QR code in the terminal is a practical example that developers can easily follow. This section is well-documented.- 59-80: The documentation and example for the
signature
method are clear, showing how to change the bot's signature. The try-catch block in the example is a good practice, as it demonstrates error handling when calling the method. This section effectively communicates the method's purpose and usage.- 82-104: The documentation and example for the
name
method clearly explain how to change the bot's name. The example demonstrates both retrieving the current name and setting a new name, providing a comprehensive guide on using the method. This section is well-documented and informative.docusaurus/i18n/zh/docusaurus-plugin-content-docs/current/api/contact.md (19)
- 1-3: The front matter of the markdown file correctly specifies the title as "Contact Class". This is essential for the documentation site to correctly display the title on the webpage.
- 5-9: The introduction provides a clear and concise description of the
Contact
class, stating that all contacts (friends) are encapsulated as instances of theContact
class. This is a good start to the documentation as it sets the context for the reader.- 10-10: Including a link to an example (
Examples/Contact-Bot
) is a great way to provide practical usage scenarios to the readers. It helps in understanding how theContact
class can be utilized in real-world applications.- 16-20: The properties section is well-structured with a table listing the properties of the
Contact
class. However, the description for theid
property mentions "这个ID 是否为永久唯一ID 取决于您使用什么puppet". It would be beneficial to clarify that while theid
is generally unique, its permanence and uniqueness can depend on the underlying puppet being used.Consider adding a note to clarify the conditions under which the
id
might not be a permanent unique identifier.
- 22-39: The instance methods section is comprehensive, listing various methods available for the
Contact
class instances along with their return types. This section is crucial for developers to understand how to interact with contact instances. The formatting and presentation are clear, making it easy to read and understand.- 40-45: The static methods section correctly lists the methods that can be called on the
Contact
class itself, rather than on instances of the class. This distinction is important for developers to understand which methods are available directly from the class.- 47-53: The detailed explanation for the
contact.say
method is helpful, including the types of messages that can be sent (text, Contact, File, UrlLink, MiniProgram). The note about puppet compatibility is crucial, as it sets the right expectations regarding the method's availability across different puppets.- 55-108: The examples provided for using the
contact.say
method are comprehensive and cover a wide range of use cases, including sending text messages, files, contact cards, URL links, and mini programs. These examples are practical and will greatly aid developers in understanding how to use the method effectively.- 110-112: The documentation for the
contact.name
method is concise and to the point, explaining that it retrieves the contact's nickname. This is a straightforward method, and the documentation appropriately reflects its simplicity.- 120-126: The
contact.alias
method documentation provides a clear explanation of how to get, set, or delete a friend's alias. The caution about the potential for setting the alias to fail if done too frequently is valuable information for developers to avoid unintended issues.- 162-164: The explanation for the
Contact.friend
method is clear, indicating whether the contact is a friend of the bot. The note about the method's implementation depending on the puppet used is again helpful for setting the right expectations.- 174-176: The documentation for the
Contact.type
method, which retrieves the type of the contact (e.g., personal, official), is succinct. The mention ofContactType
being an enum provides a hint to developers about looking into the enum values for more details.- 188-190: The
contact.gender
method documentation is straightforward, explaining how to retrieve the contact's gender. Including thatContactGender
is an enum helps guide developers to further explore the possible values.- 199-201: The sections on
Contact.province
andContact.city
methods are brief and informative, explaining how to get the contact's province and city information. These methods provide valuable data for applications that need to process or display location-based information.- 219-221: The documentation for the
Contact.avatar
method, which retrieves the contact's avatar, is clear. The example provided demonstrates how to save the avatar to a local file, which is a practical use case that developers might need to implement.- 234-236: The
Contact.sync
method documentation, explaining the purpose of forcing a reload of friend data, is concise. This method can be crucial for ensuring that the bot has the latest information, especially in long-running applications.- 244-246: The explanation for the
Contact.self
method, which checks if the contact is the bot itself, is straightforward. This method can be particularly useful in scenarios where the bot needs to differentiate between actions taken by itself and those taken by other contacts.- 254-258: The static methods
Contact.find
andContact.findAll
are well-documented, providing clear instructions on how to search for contacts by name or alias. The examples given are practical and demonstrate how to use these methods effectively.- 296-307: The
ContactQueryFilter
typedef section is a valuable addition, explaining the criteria that can be used to search for contacts. This section helps developers understand the options available for filtering contacts, enhancing the usability of theContact.find
andContact.findAll
methods.docusaurus/i18n/zh/docusaurus-plugin-content-docs/current/api/room.md (2)
- 55-129: The code examples provided for interacting with the
Room
class in Wechaty are clear and demonstrate a variety of functionalities such as sending messages, handling files, and dealing with room events. However, it's important to ensure that these examples are tested and up-to-date with the latest version of Wechaty to provide accurate guidance to developers.Ensure all code examples are tested with the latest Wechaty version for accuracy.
- 1-589: Overall, the documentation for the
Room
class in the Wechaty framework is well-structured and informative, providing Chinese-speaking developers with valuable insights into using Wechaty for building WeChat bots. To further enhance the documentation, consider adding more examples and clarifications for complex functionalities or those that depend on specific puppet implementations. This will help developers better understand how to leverage the Wechaty framework for their projects.Consider adding more examples and clarifications for complex functionalities or puppet-specific behaviors.
* contactSelf.avatar\(\[file\]\) ⇒ `Promise <void | FileBox>` | ||
* contactSelf.qrcode\(\) ⇒ `Promise <string>` | ||
* contactSelf.signature\(signature\) ⇒ `Promise <string>` | ||
* contactSelf.name\(\[name\]\) ⇒ `Promise <void> | string` |
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>
and Promise<void> | string
have slightly different spacing around the |
symbol. Consistency in such details improves readability.
- * contactSelf.avatar\(\[file\]\) ⇒ `Promise <void | FileBox>`
+ * contactSelf.avatar\(\[file\]\) ⇒ `Promise<void | FileBox>`
- * contactSelf.name\(\[name\]\) ⇒ `Promise <void> | string`
+ * contactSelf.name\(\[name\]\) ⇒ `Promise<void> | string`
Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation.
* 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>` | |
* contactSelf.qrcode\(\) ⇒ `Promise <string>` | |
* contactSelf.signature\(signature\) ⇒ `Promise <string>` | |
* contactSelf.name\(\[name\]\) ⇒ `Promise<void> | string` |
|
||
| 名称 | 类型 | 描述 | | ||
| :--- | :--- | :--- | | ||
| id | `string` | 获取群ID。这个ID 是否是永久不变的ID 取决于使用哪一个puppet,具体 查看puppet兼容性清单,参照 [puppet-compatible-table](https://wechaty.js.org/docs/specs/puppet/) | |
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 abbreviation for "identification" should be spelled in all uppercase letters as "ID" to maintain consistency and correctness. This change was previously suggested but seems to have been overlooked. Please ensure that all instances of "ID" in the document follow this convention for clarity and professionalism.
- 获取群ID。这个ID 是否是永久不变的ID 取决于使用哪一个puppet
+ 获取群ID。这个ID 是否是永久不变的ID 取决于使用哪一个puppet
Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation.
| id | `string` | 获取群ID。这个ID 是否是永久不变的ID 取决于使用哪一个puppet,具体 查看puppet兼容性清单,参照 [puppet-compatible-table](https://wechaty.js.org/docs/specs/puppet/) | | |
| id | `string` | 获取群ID。这个ID 是否是永久不变的ID 取决于使用哪一个puppet,具体 查看puppet兼容性清单,参照 [puppet-compatible-table](https://wechaty.js.org/docs/specs/puppet/) | |
- [wechaty.start()](#wechatystart) | ||
- [wechaty.say()](#wechatysaysayable-sayable) | ||
- [wechaty.publish(post: PostInterface)](#wechatypublishpost-postinterface) | ||
一个Wechaty Bot代表着一个微信的客户端,他取决于你具体使用哪一个Puppet。 |
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.
Considering the previous comment about maintaining consistency with the official product name, it's recommended to replace "微信" with "WeChat" to align with the official branding.
- 一个Wechaty Bot代表着一个微信的客户端
+ 一个Wechaty Bot代表着一个WeChat的客户端
Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation.
一个Wechaty Bot代表着一个微信的客户端,他取决于你具体使用哪一个Puppet。 | |
一个Wechaty Bot代表着一个WeChat的客户端,他取决于你具体使用哪一个Puppet。 |
* **web-wechat** - 当使用Puppet-Puppeteer 或 Puppet-wechat4u | ||
* **ipad-wechat** - 当使用Puppet-padchat | ||
* **ios-wechat** - 当使用Puppet-ioscat |
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.
To ensure consistency and clarity in the documentation, it's advisable to capitalize the brand names as previously suggested. This change will help maintain a professional and uniform appearance throughout the document.
- * **web-wechat** - 当使用Puppet-Puppeteer 或 Puppet-wechat4u
- * **ipad-wechat** - 当使用Puppet-padchat
- * **ios-wechat** - 当使用Puppet-ioscat
+ * **Web-WeChat** - 当使用Puppet-Puppeteer 或 Puppet-wechat4u
+ * **iPad-WeChat** - 当使用Puppet-padchat
+ * **iOS-WeChat** - 当使用Puppet-ioscat
Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation.
* **web-wechat** - 当使用Puppet-Puppeteer 或 Puppet-wechat4u | |
* **ipad-wechat** - 当使用Puppet-padchat | |
* **ios-wechat** - 当使用Puppet-ioscat | |
* **Web-WeChat** - 当使用Puppet-Puppeteer 或 Puppet-wechat4u | |
* **iPad-WeChat** - 当使用Puppet-padchat | |
* **iOS-WeChat** - 当使用Puppet-ioscat |
| :--- | :--- | :--- | | ||
| \[options\] | `WechatyOptions` | `{}` | | ||
|
||
**Example** _\(世界上最短的对话机器人代码\)_ |
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.
As previously mentioned, using an arrow symbol (→) instead of the dash (-) could enhance readability in the example code comment. This minor change can make the documentation look cleaner and more accessible.
- **Example** _\(世界上最短的对话机器人代码\)_
+ **Example** _→ \(世界上最短的对话机器人代码\)_
Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation.
**Example** _\(世界上最短的对话机器人代码\)_ | |
**Example** _→ \(世界上最短的对话机器人代码\)_ |
Summary by CodeRabbit
ContactSelf
,Contact
, andRoom
classes in Chinese.