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

Commit c598391

Browse files
author
astrbot-docs-agent[bot]
committed
docs: update for AstrBotDevs/AstrBot#5331
1 parent 7f682f5 commit c598391

File tree

2 files changed

+52
-0
lines changed

2 files changed

+52
-0
lines changed

en/dev/star/guides/listen-message-event.md

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -252,6 +252,32 @@ async def on_astrbot_loaded(self):
252252

253253
```
254254

255+
#### On Plugin Loaded
256+
257+
Triggered when a plugin has finished loading. You can access the plugin's metadata.
258+
259+
```python
260+
from astrbot.api.event import filter
261+
from astrbot.api.star import StarMetadata
262+
263+
@filter.on_plugin_loaded()
264+
async def on_plugin_loaded(self, metadata: StarMetadata):
265+
print(f"Plugin {metadata.name} has been loaded")
266+
```
267+
268+
#### On Plugin Unloaded
269+
270+
Triggered when a plugin has finished unloading. You can access the plugin's metadata.
271+
272+
```python
273+
from astrbot.api.event import filter
274+
from astrbot.api.star import StarMetadata
275+
276+
@filter.on_plugin_unloaded()
277+
async def on_plugin_unloaded(self, metadata: StarMetadata):
278+
print(f"Plugin {metadata.name} has been unloaded")
279+
```
280+
255281
#### On LLM Request
256282

257283
In AstrBot's default execution flow, the `on_llm_request` hook is triggered before calling the LLM.

zh/dev/star/guides/listen-message-event.md

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -252,6 +252,32 @@ async def on_astrbot_loaded(self):
252252

253253
```
254254

255+
#### 插件加载完成时
256+
257+
当有插件加载完成时触发,可以获取到该插件的元数据。
258+
259+
```python
260+
from astrbot.api.event import filter
261+
from astrbot.api.star import StarMetadata
262+
263+
@filter.on_plugin_loaded()
264+
async def on_plugin_loaded(self, metadata: StarMetadata):
265+
print(f"插件 {metadata.name} 已加载")
266+
```
267+
268+
#### 插件卸载完成时
269+
270+
当有插件卸载完成时触发,可以获取到该插件的元数据。
271+
272+
```python
273+
from astrbot.api.event import filter
274+
from astrbot.api.star import StarMetadata
275+
276+
@filter.on_plugin_unloaded()
277+
async def on_plugin_unloaded(self, metadata: StarMetadata):
278+
print(f"插件 {metadata.name} 已卸载")
279+
```
280+
255281
#### 等待 LLM 请求时
256282

257283
在 AstrBot 准备调用 LLM 但还未获取会话锁时,会触发 `on_waiting_llm_request` 钩子。

0 commit comments

Comments
 (0)