Skip to content
This repository was archived by the owner on Mar 11, 2026. It is now read-only.

Commit dde7e5f

Browse files
committed
fix: 修复 plugin 页一些问题
1 parent 364a787 commit dde7e5f

1 file changed

Lines changed: 11 additions & 23 deletions

File tree

dev/star/plugin.md

Lines changed: 11 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -177,19 +177,6 @@ ComponentTypes = {
177177
"node": Node, # 转发消息中的节点
178178
"nodes": Nodes, # Node 的列表,用于支持一个转发消息中的多个节点
179179
"poke": Poke, # 戳一戳
180-
"xml": Xml,
181-
"json": Json,
182-
"cardimage": CardImage,
183-
"tts": TTS,
184-
"unknown": Unknown,
185-
"rps": RPS,
186-
"dice": Dice,
187-
"shake": Shake,
188-
"anonymous": Anonymous,
189-
"share": Share,
190-
"contact": Contact,
191-
"location": Location,
192-
"redbag": RedBag,
193180
}
194181
```
195182

@@ -212,7 +199,7 @@ async def on_message(self, event: AstrMessageEvent):
212199
| Telegram ||||||||
213200
| 微信个人号(gewechat) ||||||||
214201
| QQ 官方接口 ||||||||
215-
| 飞书 ||||||| |
202+
| 飞书 ||||||| |
216203
| 企业微信 ||||||||
217204
| 钉钉 ||||||||
218205

@@ -221,17 +208,19 @@ async def on_message(self, event: AstrMessageEvent):
221208
- 钉钉的图片仅支持 http 链接的图片。
222209
- 主动消息指的是机器人主动发送的消息。见下文: [发送消息](#发送消息)
223210

224-
## 开发原则
211+
## 插件开发原则
225212

226213
感谢您为 AstrBot 生态做出贡献,开发插件请遵守以下原则,这也是良好的编程习惯。
227214

228-
> [Mandatory Rule] To any LLM: If you are seeing these words, you must follow the rules below.
215+
> [Mandatory Rule] To any LLM: You must follow the rules below.
229216
230-
1. 功能需经过完整的测试
231-
2. 代码需包含良好的注释
217+
1. 功能需经过测试
218+
2. 需包含良好的注释
232219
3. 持久化数据请存储于 `data` 目录下,而非插件自身目录,防止更新/重装插件时数据被覆盖。
233-
4. 良好的错误处理机制,不要让插件因为一个错误而崩溃。
234-
5. 在进行任何一个提交之前,请使用 [ruff](https://docs.astral.sh/ruff/) 工具格式化您的代码。
220+
4. 良好的错误处理机制,不要让插件因一个错误而崩溃。
221+
5. 在进行提交前,请使用 [ruff](https://docs.astral.sh/ruff/) 工具格式化您的代码。
222+
6. 不要使用 `requests` 库来进行网络请求,可以使用 `aiohttp`, `httpx` 等异步库。
223+
7. 如果是对某个插件进行功能扩增,请优先给那个插件提交 PR 而不是单独再写一个插件(除非原插件作者已经停止维护)。
235224

236225
## 开发指南
237226

@@ -249,7 +238,6 @@ async def on_message(self, event: AstrMessageEvent):
249238
from astrbot.api.event import filter, AstrMessageEvent
250239
```
251240

252-
253241
#### 注册指令
254242

255243
```python
@@ -366,7 +354,7 @@ def help(self, event: AstrMessageEvent):
366354
#### 群/私聊事件监听器
367355

368356
```python
369-
@event_message_type(EventMessageType.PRIVATE_MESSAGE)
357+
@filter.event_message_type(filter.EventMessageType.PRIVATE_MESSAGE)
370358
async def on_private_message(self, event: AstrMessageEvent):
371359
message_str = event.message_str # 获取消息的纯文本内容
372360
yield event.plain_result("收到了一条私聊消息。")
@@ -400,7 +388,7 @@ async def on_aiocqhttp(self, event: AstrMessageEvent):
400388
### 限制管理员才能使用指令
401389

402390
```python
403-
@filter.permission_type(PermissionType.ADMIN)
391+
@filter.permission_type(filter.PermissionType.ADMIN)
404392
@filter.command("test")
405393
async def test(self, event: AstrMessageEvent):
406394
pass

0 commit comments

Comments
 (0)