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
45 changes: 45 additions & 0 deletions en/dev/star/guides/send-message.md
Original file line number Diff line number Diff line change
Expand Up @@ -129,3 +129,48 @@ async def test(self, event: AstrMessageEvent):
```

![Sending group forward messages](https://files.astrbot.app/docs/source/images/plugin/image-4.png)

## Other Message Types

> Some platforms may not support all of the following message types.

**JSON Card**

```python
Comp.Json(data={...})
```

**Share**

```python
Comp.Share(url="...", title="...", content="...", image="...")
```

**Music Share**

```python
# Method 1: Specify platform and ID
Comp.Music(type="qq", id="...")
# Method 2: Custom
Comp.Music(type="custom", url="...", audio="...", title="...", content="...", image="...")
```

**Location**

```python
Comp.Location(lat=..., lon=..., title="...", content="...")
```

**Contact (Friend/Group)**

```python
Comp.Contact(type="qq", id="...")
```

**Magic Emoticons/Actions**

```python
Comp.Shake() # Window shake/Poke
Comp.Dice() # Roll a dice
Comp.RPS() # Rock-paper-scissors
```
8 changes: 8 additions & 0 deletions zh/dev/star/guides/listen-message-event.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ class AstrBotMessage:
- `Record`:语音消息段
- `Video`:视频消息段
- `File`:文件消息段
- `Music`:音乐分享消息段

大多数消息平台都支持上面的消息段类型。

Expand All @@ -63,6 +64,13 @@ class AstrBotMessage:
- `Node`:合并转发消息中的一个节点
- `Nodes`:合并转发消息中的多个节点
- `Poke`:戳一戳消息段
- `Json`:JSON 卡片消息段
- `Share`:分享消息段
- `Location`:位置消息段
- `Contact`:推荐好友/群消息段
- `Shake`:窗口抖动/戳一戳消息段
- `Dice`:掷骰子消息段
- `RPS`:猜拳消息段

在 AstrBot 中,消息链表示为 `List[BaseMessageComponent]` 类型的列表。

Expand Down
45 changes: 45 additions & 0 deletions zh/dev/star/guides/send-message.md
Original file line number Diff line number Diff line change
Expand Up @@ -129,3 +129,48 @@ async def test(self, event: AstrMessageEvent):
```

![发送群合并转发消息](https://files.astrbot.app/docs/source/images/plugin/image-4.png)

## 其他消息类型

> 部分平台可能不支持以下所有消息类型。

**JSON 卡片**

```python
Comp.Json(data={...})
```

**分享 Share**

```python
Comp.Share(url="...", title="...", content="...", image="...")
```

**音乐分享 Music**

```python
# 方式 1:指定平台和 ID
Comp.Music(type="qq", id="...")
# 方式 2:自定义
Comp.Music(type="custom", url="...", audio="...", title="...", content="...", image="...")
```

**位置 Location**

```python
Comp.Location(lat=..., lon=..., title="...", content="...")
```

**推荐好友/群 Contact**

```python
Comp.Contact(type="qq", id="...")
```

**魔法表情/动作**

```python
Comp.Shake() # 窗口抖动/戳一戳
Comp.Dice() # 掷骰子
Comp.RPS() # 猜拳
```
Loading