Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
vivien8261 committed Jul 1, 2024
1 parent 89ad840 commit 4a80a5b
Show file tree
Hide file tree
Showing 6 changed files with 51 additions and 37 deletions.
2 changes: 1 addition & 1 deletion docs/develop/adapters/onebot11.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
| http_port | int | ob11 服务的 http 端口 | |

```python
from amiyabot.adapters.onebot11 import onebot11
from amiyabot.adapters.onebot.v11 import onebot11

appid = '******' # 机器人的账号(如需要)
token = '******' # access-token
Expand Down
2 changes: 1 addition & 1 deletion docs/develop/adapters/onebot12.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
| http_port | int | ob12 服务的 http 端口 | |

```python
from amiyabot.adapters.onebot12 import onebot12
from amiyabot.adapters.onebot.v12 import onebot12

appid = '******' # 机器人的账号(如需要)
token = '******' # access-token
Expand Down
1 change: 1 addition & 0 deletions docs/develop/advanced/httpRequests.md
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,7 @@ res: str = await http_requests.post_upload()
|------------|-------|--------------------------------------------------------------------------------------|------|
| interface | str | 请求地址 | |
| file | bytes | 文件 bytes | |
| filename | str | 文件名 | file |
| file_field | str | 表单数据中存放文件的字段名 | file |
| payload | dict | 请求体 | |
| headers | dict | 追加的请求头 | |
Expand Down
13 changes: 9 additions & 4 deletions docs/develop/basic/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,18 +48,23 @@ asyncio.run(bot.start())
## 创建私域机器人

如果你在平台创建的是**私域机器人**,在 `AmiyaBot` 的参数里设置 `private=True`
来开启私域模式,私域机器人支持接收非 `@机器人` 的消息,你可以使机器人以更灵活的方式触发功能。<br>
但我们不希望机器人的唤起出现非预期的效果,所以建议在私域模式下,**添加前缀触发词**来唤起机器人。
来开启私域模式,私域机器人支持接收非 `@机器人` 的消息,你可以使机器人以更灵活的方式触发功能。

```python
# 配置 private=True 让实例改为私域
bot = AmiyaBot(appid='******', token='******', private=True)
```

## 使用前缀触发词唤醒机器人

```python
bot = AmiyaBot(...)

# 添加前缀触发词(非必须)
# 添加前缀触发词
bot.set_prefix_keywords(['amiya', 'amy'])
```

使用前缀触发词唤醒机器人
此时机器人只能接收指定前缀的对话

<img style="width: 220px" src="../../assets/examples/hello2.png" alt="image">

Expand Down
59 changes: 33 additions & 26 deletions docs/develop/basic/recvMessage.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,34 +22,41 @@ async def _(data: Message):

## Message 对象

::: warning 重要变动 <br>
`1.9.8` 起,如果配置了[前缀触发词](/develop/basic/#使用前缀触发词唤醒机器人),Message
对象内的消息文本系列字段将不再包含触发对话的前缀([Commit 99ada6b](https://github.com/AmiyaBot/Amiya-Bot-core/commit/99ada6b494d3115cee58eef2a119eea334bb8f23)),
前缀在对话文本中被移除后将赋值到 `text_prefix` 属性内。
:::

### 属性

| 属性 | 类型 | 释义 |
|---------------|-----------------------------------------------------------------------------------------------|---------------------|
| instance | BotAdapterProtocol | bot 实例 |
| message | dict | 原始消息字典 |
| message_id | str | 消息 ID |
| message_type | str | 消息类型(适用于群聊适配器) |
| face | List[str] | 消息内表情 ID 列表 |
| image | List[str] | 消息内图片 URL 列表 |
| text | str | 消息文本(中间件处理) |
| text_digits | str | 消息文本(中间件处理、中文转数字处理) |
| text_unsigned | str | 消息文本(去字符处理) |
| text_original | str | 消息文本(原始文本) |
| text_words | List[str] | 消息文本分词 |
| at_target | List[str] | 消息内 @ 的对象列表 |
| is_at | bool | 是否 @ 机器人 |
| is_admin | bool | 是否为子频道管理员 |
| is_direct | bool | 是否是私信消息 |
| user_id | str | 用户 ID |
| guild_id | str | 频道 ID |
| src_guild_id | str | 来源频道 ID,私信下有效 |
| channel_id | str | 子频道 ID |
| nickname | str | 用户昵称 |
| avatar | str | 用户头像的 URL |
| joined_at | ISO8601 timestamp | 用户加入频道的时间 |
| verify | [Verify 对象](/develop/basic/messageHandler.html#%E8%87%AA%E5%AE%9A%E4%B9%89%E6%A3%80%E6%9F%A5) | 自定义检查的结果 |
| time | int | 消息时间 |
| 属性 | 类型 | 释义 |
|---------------|-------------------------------------------------------|----------------------------|
| instance | BotAdapterProtocol | bot 实例 |
| message | dict | 原始消息字典 |
| message_id | str | 消息 ID |
| message_type | str | 消息类型(适用于群聊适配器) |
| face | List[str] | 消息内表情 ID 列表 |
| image | List[str] | 消息内图片 URL 列表 |
| text | str | 消息文本(不包含触发词、中间件处理) |
| text_digits | str | 消息文本(不包含触发词、中间件处理、中文转数字处理) |
| text_unsigned | str | 消息文本(不包含触发词、去字符处理) |
| text_original | str | 消息文本(原始文本) |
| text_words | List[str] | 消息文本分词 |
| text_prefix | str | 消息触发词 |
| at_target | List[str] | 消息内 @ 的对象列表 |
| is_at | bool | 是否 @ 机器人 |
| is_admin | bool | 是否为子频道管理员 |
| is_direct | bool | 是否是私信消息 |
| user_id | str | 用户 ID |
| guild_id | str | 频道 ID |
| src_guild_id | str | 来源频道 ID,私信下有效 |
| channel_id | str | 子频道 ID |
| nickname | str | 用户昵称 |
| avatar | str | 用户头像的 URL |
| joined_at | ISO8601 timestamp | 用户加入频道的时间 |
| verify | [Verify 对象](/develop/basic/messageHandler.html#自定义检查) | 自定义检查的结果 |
| time | int | 消息时间 |

### 方法

Expand Down
11 changes: 6 additions & 5 deletions docs/download.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,14 @@ import download from './components/download.vue'

# 下载

[![amiyabot](https://img.shields.io/pypi/v/amiyabot)](https://pypi.org/project/amiyabot/#files)

```bash
pip install amiyabot
```

## 兔兔-v6

| 操作系统 | 下载 | 备注 |
|---------|------------------------------|------------------------------------------|
| Windows | <download version="win32" /> | 仅支持 Windows 10、Windows Server 2016 及以上系统 |
| Linux | <download version="linux" /> | 不支持 Centos,目前在 Ubuntu 20.04 测试可用 |

## 框架最新版本

![amiyabot](https://img.shields.io/pypi/v/amiyabot)

0 comments on commit 4a80a5b

Please sign in to comment.