fix(docs): fix multiple errors in plugin development guides#8166
Conversation
There was a problem hiding this comment.
Hey - I've found 1 issue, and left some high level feedback:
- In the command examples, you’ve updated
addandcalc_helpto beasync, but other command handlers in the same docs (e.g. those under@math.command) are still sync; consider making all handler examples consistentlyasyncto avoid confusing plugin authors about the required function signature. - The hardcoded
PlatformAdapterTypelists in the docs are now much more complete; to reduce future drift, it might be worth adding a short note pointing readers to the canonical enum / mapping in the codebase so the docs don’t need manual updates every time a new adapter is added.
Prompt for AI Agents
Please address the comments from this code review:
## Overall Comments
- In the command examples, you’ve updated `add` and `calc_help` to be `async`, but other command handlers in the same docs (e.g. those under `@math.command`) are still sync; consider making all handler examples consistently `async` to avoid confusing plugin authors about the required function signature.
- The hardcoded `PlatformAdapterType` lists in the docs are now much more complete; to reduce future drift, it might be worth adding a short note pointing readers to the canonical enum / mapping in the codebase so the docs don’t need manual updates every time a new adapter is added.
## Individual Comments
### Comment 1
<location path="docs/zh/dev/star/guides/listen-message-event.md" line_range="100-101" />
<code_context>
-def add(self, event: AstrMessageEvent, a: int, b: int):
+async def add(self, event: AstrMessageEvent, a: int, b: int):
# /add 1 2 -> 结果是: 3
yield event.plain_result(f"Wow! The anwser is {a + b}!")
```
</code_context>
<issue_to_address>
**issue (typo):** Fix the typo "anwser" in the example string.
```suggestion
# /add 1 2 -> 结果是: 3
yield event.plain_result(f"Wow! The answer is {a + b}!")
```
</issue_to_address>Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
There was a problem hiding this comment.
Code Review
This pull request primarily updates the documentation and docstring examples to align with current API standards, including the use of async def for command handlers and the expansion of the PlatformAdapterType list. It also refines message component usage and fixes several typos. Review feedback identifies an inconsistency in the documented parameter count for LLM requests, a spelling error in the Chinese guide, and missing platform entries in the plugin development documentation.
| ``` | ||
|
|
||
| 请务必接收两个参数:event, request | ||
| 请务必接收两个参数:event, req |
| - `misskey` | ||
| - `line` | ||
| - `matrix` | ||
| - `mattermost` |
There was a problem hiding this comment.
webchat是内置功能,不需要列入support_platforms
| - `misskey` | ||
| - `line` | ||
| - `matrix` | ||
| - `mattermost` |
There was a problem hiding this comment.
webchat是内置功能,不需要列入support_platforms
|
thanks! |
通过惊人的注意力发现了文档的一些错误
Modifications / 改动点
def add/def calc_help应为async def(docs/zh|en/dev/star/guides/listen-message-event.md)
on_decorating_result示例缺少Plain导入(docs/zh|en/dev/star/guides/listen-message-event.md)
PlatformAdapterType不完整(docs/zh|en/dev/star/guides/listen-message-event.md)
delete_personaRaises 字段拼写错误(docs/zh/dev/star/guides/ai.md)
Valueable→ValueError,与persona_mgr.py实际raise类型一致。support_platforms列表不完整(docs/zh|en/dev/star/plugin-new.md)
缺少
qq_official_webhook、wecom_ai_bot、weixin_oc、matrix、mattermost5 个平台。(还是要声明一下好?)simple.md导入了已废弃的register(docs/zh/dev/star/guides/simple.md)
register_star装饰器自 v3.5.20 起标注DeprecationWarning。star_handler.pydocstring 参数命名不一致(astrbot/core/star/register/star_handler.py)
register_on_llm_request的 docstring 示例使用request,而调用处internal.py变量名为req,用户文档两处示例也均为req。将 docstring 统一改为req,消除歧义。self参数前后不一致(docs/zh|en/dev/star/guides/listen-message-event.md)
同文件两处示例,一处写
def math(self):,另一处写def math():。统一改为无self。Screenshots or Test Results / 运行截图或测试结果
这只是一个文档错误)
Checklist / 检查清单
😊 If there are new features added in the PR, I have discussed it with the authors through issues/emails, etc.
/ 如果 PR 中有新加入的功能,已经通过 Issue / 邮件等方式和作者讨论过。
👀 My changes have been well-tested, and "Verification Steps" and "Screenshots" have been provided above.
/ 我的更改经过了良好的测试,并已在上方提供了“验证步骤”和“运行截图”。
🤓 I have ensured that no new dependencies are introduced, OR if new dependencies are introduced, they have been added to the appropriate locations in
requirements.txtandpyproject.toml./ 我确保没有引入新依赖库,或者引入了新依赖库的同时将其添加到
requirements.txt和pyproject.toml文件相应位置。😮 My changes do not introduce malicious code.
/ 我的更改没有引入恶意代码。
Summary by Sourcery
Update plugin development documentation and examples to reflect current async APIs, supported platforms, and consistent naming.
Enhancements:
Documentation: