This repository was archived by the owner on Mar 11, 2026. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +52
-0
lines changed
Expand file tree Collapse file tree 2 files changed +52
-0
lines changed Original file line number Diff line number Diff 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
257283In AstrBot's default execution flow, the ` on_llm_request ` hook is triggered before calling the LLM.
Original file line number Diff line number Diff 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 ` 钩子。
You can’t perform that action at this time.
0 commit comments