Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 26 additions & 0 deletions en/dev/star/guides/listen-message-event.md
Original file line number Diff line number Diff line change
Expand Up @@ -252,6 +252,32 @@ async def on_astrbot_loaded(self):

```

#### On Plugin Loaded

Triggered when a plugin has finished loading. You can access the plugin's metadata.

```python
from astrbot.api.event import filter
from astrbot.api.star import StarMetadata

@filter.on_plugin_loaded()
async def on_plugin_loaded(self, metadata: StarMetadata):
print(f"Plugin {metadata.name} has been loaded")
```

#### On Plugin Unloaded

Triggered when a plugin has finished unloading. You can access the plugin's metadata.

```python
from astrbot.api.event import filter
from astrbot.api.star import StarMetadata

@filter.on_plugin_unloaded()
async def on_plugin_unloaded(self, metadata: StarMetadata):
print(f"Plugin {metadata.name} has been unloaded")
```

#### On LLM Request

In AstrBot's default execution flow, the `on_llm_request` hook is triggered before calling the LLM.
Expand Down
26 changes: 26 additions & 0 deletions zh/dev/star/guides/listen-message-event.md
Original file line number Diff line number Diff line change
Expand Up @@ -252,6 +252,32 @@ async def on_astrbot_loaded(self):

```

#### 插件加载完成时

当有插件加载完成时触发,可以获取到该插件的元数据。

```python
from astrbot.api.event import filter
from astrbot.api.star import StarMetadata

@filter.on_plugin_loaded()
async def on_plugin_loaded(self, metadata: StarMetadata):
print(f"插件 {metadata.name} 已加载")
```

#### 插件卸载完成时

当有插件卸载完成时触发,可以获取到该插件的元数据。

```python
from astrbot.api.event import filter
from astrbot.api.star import StarMetadata

@filter.on_plugin_unloaded()
async def on_plugin_unloaded(self, metadata: StarMetadata):
print(f"插件 {metadata.name} 已卸载")
```

#### 等待 LLM 请求时

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