Skip to content

Commit

Permalink
feat: python拉取表情表态用户列表 (#136)
Browse files Browse the repository at this point in the history
* feat: python拉取表情表态用户列表

* feat: 私信事件加入来源频道的id

* feat: python支持设置成员或身份组主播权限
  • Loading branch information
DaiJiChen committed May 17, 2022
1 parent 09b65f2 commit 0efabd9
Show file tree
Hide file tree
Showing 5 changed files with 70 additions and 1 deletion.
45 changes: 45 additions & 0 deletions docs/develop/pythonsdk/api/reaction/get_reaction_users.md
@@ -0,0 +1,45 @@
# 拉取表情表态用户列表

拉取对消息 `message_id` 指定表情表态的用户列表

## 使用示例

#### sync

```python
import qqbot

token = qqbot.Token({appid}, {token})


def demo():
api = qqbot.ReactionAPI(token, False)
reaction_users = api.get_reaction_users(channel_id, message_id, EmojiType.system, "4", ReactionUsersPager())
```

#### async

```python
import qqbot

token = qqbot.Token({appid}, {token})


async def demo():
api = qqbot.AsyncReactionAPI(token, False)
reaction_users = await api.get_reaction_users(channel_id, message_id, EmojiType.system, "4", ReactionUsersPager())
```

## 参数说明

| 字段名 | 必填 | 类型 | 描述 |
| ----------- | ---- | ------------------------------------- | -------------------------------- |
| channel_id || string | 子频道 ID |
| message_id || string | 消息 ID |
| type || int | 表情类型,参考[EmojiType](../../model/emoji.md#EmojiType) |
| emoji_id || string | 表情 ID,参考 [Emoji 列表](../../model/emoji.md#Emoji-列表) |
| pager || ReactionUsersPager 对象 | 拉取表情表态用户列表的分页对象,参考[ReactionUsersPager](../../model/reaction.md#ReactionUsersPager)|

## 返回说明

返回 [ReactionUsers 对象](../../model/reaction.md#ReactionUsers)
3 changes: 2 additions & 1 deletion docs/develop/pythonsdk/config.js
Expand Up @@ -131,7 +131,8 @@ module.exports = {
sidebarDepth: 0,
children: [
'api/reaction/post_reaction.md',
'api/reaction/delete_reaction.md'
'api/reaction/delete_reaction.md',
'api/reaction/get_reaction_users.md'
],
},
{
Expand Down
4 changes: 4 additions & 0 deletions docs/develop/pythonsdk/model/channel_permission.md
Expand Up @@ -12,12 +12,16 @@

权限是 QQ 频道管理频道成员的一种方式,管理员可以对不同的人、不同的子频道设置特定的权限。用户的权限包括**个人权限****身份组权限**两部分,最终生效是取两种权限的并集。

*注意:不能设置ID为1的身份组权限。逻辑上未获得任何身份组权限的普通用户被归到"普通用户"身份组(ID=1)。*

权限使用位图表示,传递时序列化为十进制数值字符串。如权限值为`0x6FFF`,会被序列化为十进制`"28671"`

| 权限 || 描述 |
| ------------ | --------------------- | ---------------------------------------------------- |
| 可查看子频道 | 0x0000000001 (1 << 0) | 目前仅支持`指定成员`可见类型,不支持`身份组`可见类型 |
| 可管理子频道 | 0x0000000002 (1 << 1) | 创建者、管理员、子频道管理员都具有此权限 |
| 可发言子频道 | 0x0000000004 (1 << 2) | 支持`指定成员`发言类型,支持`身份组`发言类型 |
| 可直播子频道 | 0x0000000004 (1 << 3) | 支持`指定成员`发起直播,支持`身份组`发起直播;仅可在直播子频道中设置 |

##### 参数参考

Expand Down
1 change: 1 addition & 0 deletions docs/develop/pythonsdk/model/message.md
Expand Up @@ -20,6 +20,7 @@
| seq | number | 用于消息间的排序,seq 在同一子频道中按从先到后的顺序递增,不同的子频道之前消息无法排序。(目前只在消息事件中有值,后续废弃) |
| seq_in_channel | string | 子频道消息 seq,用于消息间的排序,seq 在同一子频道中按从先到后的顺序递增,不同的子频道之前消息无法排序 |
| message_reference| [MessageReference](#messagereference) | 引用消息对象 |
| src_guild_id | string | 用于私信场景下识别真实的来源频道id |

## MessageSendRequest

Expand Down
18 changes: 18 additions & 0 deletions docs/develop/pythonsdk/model/reaction.md
Expand Up @@ -25,6 +25,24 @@
| id | string | 表态对象 ID |
| type | number | 表态对象类型,参考 [ReactionTargetType](#reactiontargettype) |


## ReactionUsers

| 字段名 | 类型 | 描述 |
| ---------- | --------------------------------- | ------------------------- |
| users | User 对象列表 | 用户对象列表,参考 [User](./user.md),会返回 id, username, avatar 等 |
| cookie | string | 分页参数,用于拉取下一页 |
| is_end | bool | 是否已拉取完成到最后一页,true代表完成 |


## ReactionUsersPager

| 字段名 | 类型 | 描述 |
| ------ | ------ | ------------------------------------ |
| cookie | string | 上次请求返回的cookie,第一次请求无需填写 |
| limit | int | 每次拉取数量,默认20,最多50,只须第一次请求时设置 |


## ReactionTargetType

|| 描述 |
Expand Down

0 comments on commit 0efabd9

Please sign in to comment.