# 修改频道身份组

修改频道身份组信息。

# 使用示例

import botpy
from botpy.message import Message

class MyClient(botpy.Client):
    async def on_at_message_create(self, message: Message):
        await self.api.update_guild_role(
            guild_id="xxxx",
            role_id="xxxx',
            name="xxxx",
            color="10395294",
            hoist=1,
        )

intents = botpy.Intents(public_guild_messages=True)
client = MyClient(intents=intents)
client.run(appid={appid}, token={token})
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16

注意

需要使用的 token 对应的用户具备创建身份组权限。如果是机器人,要求被添加为管理员

# 参数说明

字段名 必填 类型 描述
guild_id string 频道 ID
role_id string 身份组 ID
name string 名称
color number ARGB 的 HEX 十六进制颜色值转换后的十进制数值(例:4294927682)
hoist number 在成员列表中单独展示: 0-否, 1-是

# 返回说明

字段名 类型 描述
guild_id string 频道 ID
role_id string 身份组 ID
role GuildRole 频道身份组对象

# GuildRole

字段名 类型 描述
id string 身份组 ID
name string 名称
color number ARGB 的 HEX 十六进制颜色值转换后的十进制数值(例:4294927682)
hoist number 是否在成员列表中单独展示: 0-否, 1-是
number number 人数
member_limit number 成员上限

# 返回示例

data

{
    "guild_id": "guild_id",
    "role_id": "role_id",
    "role": {
        "id": "role_id",
        "name": "Test Update Role",
        "color": 4278245297,
        "hoist": 0,
        "number": 0,
        "member_limit": 2000}
}
1
2
3
4
5
6
7
8
9
10
11
手机QQ扫码
开发者社区
加入官方频道开发者社区